From 41ce3ffce1e41a255206257b6c4b3adc94f565a1 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 18 Dec 2017 16:17:10 +0100 Subject: [PATCH] fchash: Fix replace When we replace a bucket in the hashtable we have to update the next pointer too, or we lose all the other elements that hashed to this key. --- src/fchash.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/fchash.c b/src/fchash.c index 5c1a281..ba6a453 100644 --- a/src/fchash.c +++ b/src/fchash.c @@ -182,6 +182,7 @@ FcHashTableAddInternal (FcHashTable *table, { if (replace) { + bucket->next = b->next; if (!fc_atomic_ptr_cmpexch (prev, b, bucket)) goto retry; bucket = b; @@ -191,6 +192,7 @@ FcHashTableAddInternal (FcHashTable *table, goto destroy; } } + bucket->next = NULL; if (!fc_atomic_ptr_cmpexch (prev, b, bucket)) goto retry; -- 2.13.6