Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
lib/skiplist.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/skiplist.c b/lib/skiplist.c
index 68e7d81..42c0e7f 100644
--- a/lib/skiplist.c
+++ b/lib/skiplist.c
@@ -358,11 +358,12 @@ skiplist_iter_next(qb_map_iter_t* i, void** value)
return NULL;
}
si->n = skiplist_node_next(p);
- skiplist_node_deref(p, (struct skiplist *)i->m);
if (si->n == NULL) {
+ skiplist_node_deref(p, (struct skiplist *)i->m);
return NULL;
}
si->n->refcount++;
+ skiplist_node_deref(p, (struct skiplist *)i->m);
*value = si->n->value;
return si->n->key;
}
--
1.7.6