From 723ba6024c4821a8902dba0248dfab70f56a8203 Mon Sep 17 00:00:00 2001 From: Gregor Beck Date: Mon, 30 May 2011 09:31:21 +0200 Subject: s3:net: registry export: close key after recursion returns Signed-off-by: Michael Adam Autobuild-User: Michael Adam Autobuild-Date: Mon May 30 18:53:28 CEST 2011 on sn-devel-104 --- source3/utils/net_registry.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source3') diff --git a/source3/utils/net_registry.c b/source3/utils/net_registry.c index 961cfc1553..ab8fb4e3a7 100644 --- a/source3/utils/net_registry.c +++ b/source3/utils/net_registry.c @@ -1100,7 +1100,6 @@ static int registry_export(TALLOC_CTX *ctx, /*const*/ struct registry_key* key, struct registry_value *valvalue = NULL; char *valname = NULL; - struct registry_key* subkey = NULL; char *subkey_name = NULL; NTTIME modtime = 0; @@ -1126,6 +1125,8 @@ static int registry_export(TALLOC_CTX *ctx, /*const*/ struct registry_key* key, W_ERROR_IS_OK(werr); count++) { + struct registry_key* subkey = NULL; + werr = reg_openkey(ctx, key, subkey_name, REG_KEY_READ, &subkey); if (!W_ERROR_IS_OK(werr)) { @@ -1135,6 +1136,7 @@ static int registry_export(TALLOC_CTX *ctx, /*const*/ struct registry_key* key, } registry_export(ctx, subkey, f); + TALLOC_FREE(subkey); } if (!W_ERROR_EQUAL(WERR_NO_MORE_ITEMS, werr)) { d_fprintf(stderr, _("reg_enumkey failed: %s\n"), -- cgit