summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2017-12-18 16:17:10 +0100
committerAkira TAGOH <akira@tagoh.org>2017-12-19 12:07:50 +0900
commit0b59a65a71b5482aab63a2fe7eff2820f2512941 (patch)
treea74ce519cf655059d0decdb3cb764c445f58950f /src
parent7ca28c2fedb34c1db5ee3116d335f15195859db0 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/fchash.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/fchash.c b/src/fchash.c
index 5c1a281b..ba6a4539 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;