Skip to content

Commit

Permalink
Merge pull request #2272 from 3chas3/add-missing-assert-in-zhash
Browse files Browse the repository at this point in the history
Problem: strdup can fail creating a new item with a bad key
  • Loading branch information
sphaero authored Aug 24, 2023
2 parents d26ea1a + dd6f186 commit 1f14c25
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 1f14c25

Please sign in to comment.