diff options
-rw-r--r-- | source4/lib/registry/ldb.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index b2b1e745f3..f0a1c431c5 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -522,12 +522,15 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h, } newkd = talloc_zero(mem_ctx, struct ldb_key_data); + W_ERROR_HAVE_NO_MEMORY(newkd); newkd->key.ops = ®_backend_ldb; newkd->ldb = talloc_reference(newkd, kd->ldb); - newkd->dn = ldb_dn_copy(mem_ctx, res->msgs[0]->dn); + newkd->dn = ldb_dn_copy(newkd, res->msgs[0]->dn); newkd->classname = talloc_steal(newkd, ldb_msg_find_attr_as_string(res->msgs[0], "classname", NULL); + talloc_free(res); + *key = (struct hive_key *)newkd; return WERR_OK; |