X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=mem.c;fp=mem.c;h=0795bf3b66f93ab42d0632f6e0c22ffa1e25a43b;hb=34b03028378025ad22c8d29f70e81109cee690c2;hp=1b9627cc145da0a1253295202e3580c5cb1a936f;hpb=0f9e9f98538575cf98f55699962d605caa9567f0;p=onak.git diff --git a/mem.c b/mem.c index 1b9627c..0795bf3 100644 --- a/mem.c +++ b/mem.c @@ -13,6 +13,7 @@ #include "keystructs.h" #include "ll.h" #include "mem.h" +#include "stats.h" /** * packet_dup - duplicate an OpenPGP packet. @@ -171,3 +172,22 @@ 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; + } + free(key); + } +}