X-Git-Url: https://git.sommitrealweird.co.uk/onak.git/blobdiff_plain/0d2a5aeeb4120999afc79d06619d90e26e2fec5c..HEAD:/mem.c diff --git a/mem.c b/mem.c index 47f2967..83c6384 100644 --- a/mem.c +++ b/mem.c @@ -1,9 +1,20 @@ /* * mem.c - Routines to cleanup memory after use. * - * Jonathan McDowell + * Copyright 2002-2004,2007 Jonathan McDowell * - * Copyright 2002 Project Purple + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include @@ -12,8 +23,8 @@ #include "keystructs.h" #include "ll.h" -#include "log.h" #include "mem.h" +#include "stats.h" /** * packet_dup - duplicate an OpenPGP packet. @@ -27,7 +38,8 @@ struct openpgp_packet *packet_dup(struct openpgp_packet *packet) { struct openpgp_packet *newpacket = NULL; - log_assert(packet != NULL); + if (packet == NULL) + return NULL; newpacket = malloc(sizeof (struct openpgp_packet)); if (newpacket != NULL) { @@ -59,9 +71,6 @@ void packet_list_add(struct openpgp_packet_list **list, struct openpgp_packet_list **list_end, struct openpgp_packet_list *packet_list) { - log_assert(list != NULL); - log_assert(list_end != NULL); - for (; packet_list != NULL; packet_list = packet_list->next) { ADD_PACKET_TO_LIST((*list_end), packet_dup(packet_list->packet)); @@ -81,8 +90,6 @@ void packet_list_add(struct openpgp_packet_list **list, * including the data part. */ void free_packet(struct openpgp_packet *packet) { - log_assert(packet != NULL); - if (packet->data != NULL) { free(packet->data); packet->data = NULL;