summaryrefslogtreecommitdiffstats
path: root/src/util/ralloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/ralloc.c')
-rw-r--r--src/util/ralloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/ralloc.c b/src/util/ralloc.c
index bf46439df4e..566f08ad94e 100644
--- a/src/util/ralloc.c
+++ b/src/util/ralloc.c
@@ -311,10 +311,12 @@ ralloc_adopt(const void *new_ctx, void *old_ctx)
for (child = old_info->child; child->next != NULL; child = child->next) {
child->parent = new_info;
}
+ child->parent = new_info;
/* Connect the two lists together; parent them to new_ctx; make old_ctx empty. */
child->next = new_info->child;
- child->parent = new_info;
+ if (child->next)
+ child->next->prev = child;
new_info->child = old_info->child;
old_info->child = NULL;
}