From a375be66ff7f3591886627d4dbf45dc9f8026170 Mon Sep 17 00:00:00 2001 From: Christine Caulfield Date: Tue, 11 Dec 2018 10:29:23 +0000 Subject: [PATCH] skiplist: Fix previous skiplist fix The last fix to skiplist never ran the code that patched up the level list as it updated the current level before runnign the loop. This now works. --- lib/skiplist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/skiplist.c b/lib/skiplist.c index 6a8526e69..0d467504b 100644 --- a/lib/skiplist.c +++ b/lib/skiplist.c @@ -505,10 +505,11 @@ skiplist_rm(struct qb_map *map, const char *key) (header) preceding @found_node, which can be distinguished with NULL being used as a key (second allowing condition below). */ if (found_node->refcount > 1 || cur_node->key == NULL) { - found_node->level = SKIPLIST_LEVEL_MIN - 1; /* no "forward" drop */ + for (level = SKIPLIST_LEVEL_MIN; level <= found_node->level; level++) { found_node->forward[level] = cur_node->forward[level]; } + found_node->level = SKIPLIST_LEVEL_MIN - 1; /* no "forward" drop */ free(cur_node->forward); cur_node->forward = found_node->forward; }