-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
kvttree_set incorrectly frees elem->hash when a kvtree's value hash is being set to its current hash in:
/* this key already exists, delete its current hash and reset it */
if (elem->hash != NULL) {
kvtree_delete(&elem->hash);
}
elem->hash = hash_value;Ie this:
kvtree *hash = kvtree_new();
kvtree *value = kvtree_new();
kvtree_set(hash, "key", value);
// this fails
kvtree *current = kvtree_get(hash, "key");
kvtree_set(hash, "key", current);A fix is (as in C++ with assignment of this in operator=) to check if the pointers hash_value and elem->hash in
Line 152 in cf9a903
| if (elem->hash != NULL) { |
Metadata
Metadata
Assignees
Labels
No labels