X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=mem.c;h=4a713e4ea5dec6b67fdfb8ff78a0ea22551432e9;hb=e3ac2630467e42937478a8e03dec83693912f9c4;hp=1b9627cc145da0a1253295202e3580c5cb1a936f;hpb=4b8483ae278577a3adc8d84da81d77019704466f;p=onak.git diff --git a/mem.c b/mem.c index 1b9627c..4a713e4 100644 --- a/mem.c +++ b/mem.c @@ -4,11 +4,14 @@ * Jonathan McDowell * * Copyright 2002 Project Purple + * + * $Id: mem.c,v 1.6 2003/06/07 13:45:35 noodles Exp $ */ #include #include #include +#include #include "keystructs.h" #include "ll.h" @@ -171,3 +174,26 @@ 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); + } +}