X-Git-Url: http://the.earth.li/gitweb/?a=blobdiff_plain;f=hash.c;h=e131d032b576281d1ad98e478b04185e57654cf2;hb=f86410ff8aa00dc5c584541f387f77515a8cbd89;hp=e29017cda8a98e286dbcb3ab1c7e81537276328b;hpb=7388adcea7ebace8d8c299da0e7c2e7e93da9c83;p=onak.git diff --git a/hash.c b/hash.c index e29017c..e131d03 100644 --- a/hash.c +++ b/hash.c @@ -13,6 +13,7 @@ #include "keydb.h" #include "keyid.h" #include "ll.h" +#include "mem.h" #include "stats.h" /** @@ -48,20 +49,14 @@ void destroyhash(void) { int i; struct ll *curll = NULL; - struct ll *nextll = NULL; for (i = 0; i < HASHSIZE; i++) { curll = hashtable[i]; - while (curll != NULL) { - nextll = curll->next; - /* - * TODO: The problem is the object has pointers that - * need freed too. - */ - free(curll->object); - free(curll); - curll = nextll; - } + /* + * TODO: The problem is the object has pointers that + * need freed too. + */ + llfree(curll, free_statskey); hashtable[i] = NULL; } elements = 0; @@ -144,6 +139,10 @@ struct ll *hash_getkeysigs(uint64_t keyid) { struct stats_key *key = NULL; + if (keyid == 0) { + return NULL; + } + key = findinhash(keyid); if (key == NULL) { key = malloc(sizeof(*key));