aboutsummaryrefslogtreecommitdiff
path: root/src/include/lib/radixtree.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/lib/radixtree.h')
-rw-r--r--src/include/lib/radixtree.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/include/lib/radixtree.h b/src/include/lib/radixtree.h
index d9f545d491a..2896a6efc52 100644
--- a/src/include/lib/radixtree.h
+++ b/src/include/lib/radixtree.h
@@ -1749,6 +1749,10 @@ have_slot:
if (RT_VALUE_IS_EMBEDDABLE(value_p))
{
+ /* free the existing leaf */
+ if (found && !RT_CHILDPTR_IS_VALUE(*slot))
+ RT_FREE_LEAF(tree, *slot);
+
/* store value directly in child pointer slot */
memcpy(slot, value_p, value_sz);
@@ -1765,7 +1769,7 @@ have_slot:
{
RT_CHILD_PTR leaf;
- if (found)
+ if (found && !RT_CHILDPTR_IS_VALUE(*slot))
{
Assert(RT_PTR_ALLOC_IS_VALID(*slot));
leaf.alloc = *slot;