X-Git-Url: http://the.earth.li/gitweb/?p=onak.git;a=blobdiff_plain;f=mem.c;h=6ac80e61a28897ffb1d39160ada4658a5358bf04;hp=2f13cf5fffc71fb07d92d4b74c7b0c12760324d3;hb=76f079e5ebdb34acaaa2462a8d915ee06d3c8425;hpb=5e1b22d763640c4d7a09d07920403d8d491b4410 diff --git a/mem.c b/mem.c index 2f13cf5..6ac80e6 100644 --- a/mem.c +++ b/mem.c @@ -13,8 +13,7 @@ * 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. + * this program. If not, see . */ #include @@ -23,8 +22,8 @@ #include "keystructs.h" #include "ll.h" -#include "log.h" #include "mem.h" +#include "stats.h" /** * packet_dup - duplicate an OpenPGP packet. @@ -38,7 +37,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) { @@ -70,9 +70,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)); @@ -92,8 +89,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; @@ -177,26 +172,3 @@ void free_publickey(struct openpgp_publickey *key) { key = nextkey; } } - -/** - * free_statskey - free an stats key structure. - * @key: The key to free. - * - * Takes a stats key and frees the memory used by it and the linked list - * of sigs under it. Doesn't recurse into the list as it's assumed all the - * objects referenced also exist in the hash. - */ -void free_statskey(struct stats_key *key) -{ - if (key != NULL) { - if (key->sigs != NULL) { - llfree(key->sigs, NULL); - key->sigs = NULL; - } - if (key->signs != NULL) { - llfree(key->signs, NULL); - key->signs = NULL; - } - free(key); - } -}