Skip to content

Commit

Permalink
ch_free: only shutdown/free servers once
Browse files Browse the repository at this point in the history
This is fixes a crash/invalid read on shutdown or config reload, as
noted in issues grobian#126, grobian#131 and grobian#132.
  • Loading branch information
grobian authored and Panos committed Feb 3, 2016
1 parent a00f92f commit 1c97b02
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions consistent-hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,10 @@ ch_free(ch_ring *ring)
ch_ring_entry *w = NULL;

for (; ring->entries != NULL; ring->entries = ring->entries->next) {
server_shutdown(ring->entries->server);
free(ring->entries->server);

if (ring->entries->malloced) {
server_shutdown(ring->entries->server);
free(ring->entries->server);

if (deletes == NULL) {
w = deletes = ring->entries;
} else {
Expand Down

0 comments on commit 1c97b02

Please sign in to comment.