Skip to content

Commit

Permalink
Fix memory leak in hash_ring_add_items. Fixes #19.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismoos committed Feb 16, 2018
1 parent 92af8c2 commit b791f3c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hash_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ int hash_ring_add_items(hash_ring_t *ring, hash_ring_node_t *node) {
memcpy(data + node->nameLen, &concat_buf, concat_len);

if(hash_ring_hash(ring, data, concat_len + node->nameLen, &keyInt) == -1) {
free(data);
return HASH_RING_ERR;
}
free(data);

hash_ring_item_t *item = (hash_ring_item_t*)malloc(sizeof(hash_ring_item_t));
item->node = node;
Expand Down

0 comments on commit b791f3c

Please sign in to comment.