mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
lib/dbwrap: don't alter the record on failure in db_rbt_store()
metze
This commit is contained in:
parent
a06b9b413e
commit
39ac9457a3
@ -121,7 +121,17 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
|
||||
rec_priv->node->valuesize = data.dsize;
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
node = (struct db_rbt_node *)talloc_size(db_ctx,
|
||||
offsetof(struct db_rbt_node, data) + rec->key.dsize
|
||||
+ data.dsize);
|
||||
|
||||
if (node == NULL) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
if (rec_priv->node != NULL) {
|
||||
/*
|
||||
* We need to delete the key from the tree and start fresh,
|
||||
* there's not enough space in the existing record
|
||||
@ -135,15 +145,6 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
|
||||
*/
|
||||
}
|
||||
|
||||
node = (struct db_rbt_node *)talloc_size(db_ctx,
|
||||
offsetof(struct db_rbt_node, data) + rec->key.dsize
|
||||
+ data.dsize);
|
||||
|
||||
if (node == NULL) {
|
||||
TALLOC_FREE(rec_priv->node);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
ZERO_STRUCT(node->rb_node);
|
||||
|
||||
node->keysize = rec->key.dsize;
|
||||
|
Loading…
x
Reference in New Issue
Block a user