Fix Hashtable_put to allow storing the same pointer

This commit is contained in:
Fynn Wulf 2020-10-08 22:48:35 +02:00 committed by cgzones
parent f4439b1b60
commit e5fdb80c7d

View File

@ -88,7 +88,7 @@ void Hashtable_put(Hashtable* this, unsigned int key, void* value) {
this->items++;
break;
} else if ((*bucketPtr)->key == key) {
if (this->owner)
if (this->owner && (*bucketPtr)->value != value)
free((*bucketPtr)->value);
(*bucketPtr)->value = value;
break;