in hastable_delete check if deleted entry's next pointer is NULL.
This commit is contained in:
parent
ca3638ae2c
commit
8b720f211e
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user