diff options
-rw-r--r-- | src/lib/third_party/src/ht_hash.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/third_party/src/ht_hash.c b/src/lib/third_party/src/ht_hash.c index ce50f1669..838fc2c6d 100644 --- a/src/lib/third_party/src/ht_hash.c +++ b/src/lib/third_party/src/ht_hash.c @@ -23,10 +23,10 @@ hashtable_t *ht_create(int size) { return NULL; /* Allocate pointers to the head nodes. */ - if((hashtable->table = ndpi_malloc(sizeof(entry_t *) * size)) == NULL) + if((hashtable->table = ndpi_malloc(sizeof(entry_t *) * size)) == NULL) { free(hashtable); return NULL; - else { + } else { for(i = 0; i < size; i++) hashtable->table[i] = NULL; } @@ -62,9 +62,10 @@ entry_t *ht_newpair(char *key, u_int16_t value) { if((newpair = ndpi_malloc(sizeof(entry_t))) == NULL) return NULL; - if((newpair->key = ndpi_strdup(key)) == NULL) + if((newpair->key = ndpi_strdup(key)) == NULL) { free(newpair); return NULL; + } newpair->value = value, newpair->next = NULL; |