in hastable_delete check if deleted entry's next pointer is NULL.

This commit is contained in:
vraatikka 2013-08-03 23:10:45 +03:00
parent ca3638ae2c
commit 8b720f211e

View File

@ -227,8 +227,14 @@ HASHENTRIES *entry, *ptr;
table->entries[hashkey % table->hashsize] = entry->next;
table->freefn(entry->key);
table->freefn(entry->value);
entry->key = entry->next->key;
entry->value = entry->next->value;
if (entry->next != NULL) {
entry->key = entry->next->key;
entry->value = entry->next->value;
} else {
entry->key = NULL;
entry->value = NULL;
}
free(entry);
}
else