Skip to content

Commit

Permalink
Problem: strdup can fail creating a new item with a bad key
Browse files Browse the repository at this point in the history
Solution: add an assert after call to strdup during item insertion
  • Loading branch information
3chas3 committed Aug 23, 2023
1 parent d26ea1a commit dd6f186
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/zhash.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ s_item_insert (zhash_t *self, const char *key, void *value)
}
item->value = value;
item->key = strdup (key);
assert (item->key);
item->index = self->cached_index;

// Insert into start of bucket list
Expand Down

0 comments on commit dd6f186

Please sign in to comment.