summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/dbwrap_rbt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/lib/dbwrap_rbt.c b/source3/lib/dbwrap_rbt.c
index 15d9b67414..468b9405ee 100644
--- a/source3/lib/dbwrap_rbt.c
+++ b/source3/lib/dbwrap_rbt.c
@@ -121,6 +121,10 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
memcpy(this_key.dptr, rec->key.dptr, node->keysize);
memcpy(this_val.dptr, data.dptr, node->valuesize);
+ if (del_old_keyval) {
+ SAFE_FREE(rec_priv->node);
+ }
+
parent = NULL;
p = &rec_priv->db_ctx->tree.rb_node;
@@ -157,10 +161,6 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
rb_link_node(&node->rb_node, parent, p);
rb_insert_color(&node->rb_node, &rec_priv->db_ctx->tree);
- if (del_old_keyval) {
- SAFE_FREE(rec_priv->node);
- }
-
return NT_STATUS_OK;
}