[SCM] Samba Shared Repository - branch master updated - 793f1cdbd918f2245255176572027763664d9d0b

Volker Lendecke vlendec at samba.org
Fri Jan 2 19:56:02 GMT 2009


The branch, master has been updated
       via  793f1cdbd918f2245255176572027763664d9d0b (commit)
       via  cc9771d3daa84994ceec427127a71a3cf0a34b9a (commit)
       via  de58ef45ac0510bfa510fed54010f1de67e83953 (commit)
      from  11576353f645d7d7f44a74d27545b946c6175658 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 793f1cdbd918f2245255176572027763664d9d0b
Author: scudette at gmail.com <scudette at gmail.com>
Date:   Fri Jan 2 22:41:04 2009 +1100

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

commit cc9771d3daa84994ceec427127a71a3cf0a34b9a
Author: scudette at gmail.com <scudette at gmail.com>
Date:   Fri Jan 2 22:40:32 2009 +1100

    Memory leak fixed due to accumulation of open reg keys.

commit de58ef45ac0510bfa510fed54010f1de67e83953
Author: scudette at gmail.com <scudette at gmail.com>
Date:   Fri Jan 2 22:39:58 2009 +1100

    Fixes uninitialised access as reported by valgrind.

-----------------------------------------------------------------------

Summary of changes:
 source4/lib/registry/regf.c          |    4 ++--
 source4/lib/registry/tools/common.c  |    2 +-
 source4/lib/registry/tools/regtree.c |   13 ++++++++-----
 3 files changed, 11 insertions(+), 8 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index a869ed4..4cbcb09 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -543,7 +543,7 @@ static WERROR regf_get_value(TALLOC_CTX *ctx, struct hive_key *key,
 
 	if (vk->data_length & 0x80000000) {
 		vk->data_length &=~0x80000000;
-		data->data = (uint8_t *)&vk->data_offset;
+		data->data = talloc_memdup(ctx, (uint8_t *)&vk->data_offset, vk->data_length);
 		data->length = vk->data_length;
 	} else {
 		*data = hbin_get(regf, vk->data_offset);
@@ -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",
diff --git a/source4/lib/registry/tools/regtree.c b/source4/lib/registry/tools/regtree.c
index cca009a..948ed49 100644
--- a/source4/lib/registry/tools/regtree.c
+++ b/source4/lib/registry/tools/regtree.c
@@ -55,13 +55,16 @@ static void print_tree(int level, struct registry_key *p,
 								      &keyname,
 								      NULL,
 								      NULL)); i++) {
-		SMB_ASSERT(strlen(keyname) > 0);
+
+	        SMB_ASSERT(strlen(keyname) > 0);
 		if (!W_ERROR_IS_OK(reg_open_key(mem_ctx, p, keyname, &subkey)))
-			continue;
+		        continue;
+
 		print_tree(level+1, subkey, (fullpath && strlen(name))?
-						talloc_asprintf(mem_ctx, "%s\\%s",
-								name, keyname):
-						keyname, fullpath, novals);
+                                               talloc_asprintf(mem_ctx, "%s\\%s",
+                                                               name, keyname):
+                                               keyname, fullpath, novals);
+		talloc_free(subkey);
 	}
 	talloc_free(mem_ctx);
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list