From ba01b216e23ddae9961f7120792969fc2fe075b1 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Mon, 28 Jun 2010 21:17:37 +0200 Subject: s4:lib/registry/ldb.c - fix memory handling in "ldb_open_key" --- source4/lib/registry/ldb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source4/lib/registry') 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; -- cgit