[PATCH] Changed code to use proper talloc context instead of NULL to control memory leak.

scudette at gmail.com scudette at gmail.com
Fri Jan 2 11:41:04 GMT 2009


---
 source4/lib/registry/regf.c         |    2 +-
 source4/lib/registry/tools/common.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index d6fb413..4cbcb09 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -2045,7 +2045,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx, const char *location,
 	struct tdr_pull *pull;
 	int i;
 
-	regf = (struct regf_data *)talloc_zero(NULL, struct regf_data);
+	regf = (struct regf_data *)talloc_zero(parent_ctx, struct regf_data);
 
 	regf->iconv_convenience = iconv_convenience;
 
diff --git a/source4/lib/registry/tools/common.c b/source4/lib/registry/tools/common.c
index c9f1248..d997cb0 100644
--- a/source4/lib/registry/tools/common.c
+++ b/source4/lib/registry/tools/common.c
@@ -51,7 +51,7 @@ struct registry_key *reg_common_open_file(const char *path,
 	struct registry_context *h = NULL;
 	WERROR error;
 
-	error = reg_open_hive(NULL, path, NULL, creds, ev_ctx, lp_ctx, &hive_root);
+	error = reg_open_hive(ev_ctx, path, NULL, creds, ev_ctx, lp_ctx, &hive_root);
 
 	if(!W_ERROR_IS_OK(error)) {
 		fprintf(stderr, "Unable to open '%s': %s \n",
-- 
1.5.4.3



More information about the samba-technical mailing list