[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-53-g97f9a90

Gerald (Jerry) Carter jerry at samba.org
Mon Oct 15 22:42:40 GMT 2007


The branch, v3-2-test has been updated
       via  97f9a90b823887e808cca96eca7a041f121e6111 (commit)
      from  357f00384994946485a5190b6a9c493aeee53cd2 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 97f9a90b823887e808cca96eca7a041f121e6111
Author: Alexander Bokovoy <ab at samba.org>
Date:   Mon Oct 15 07:24:44 2007 +0400

    Correctly free memory in regfio paths

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

Summary of changes:
 source/registry/regfio.c |    4 ++++
 source/utils/profiles.c  |    5 ++++-
 2 files changed, 8 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/registry/regfio.c b/source/registry/regfio.c
index 6dca0ba..93a2770 100644
--- a/source/registry/regfio.c
+++ b/source/registry/regfio.c
@@ -1171,6 +1171,7 @@ out:
 	
 	if ( !(rb->mem_ctx = talloc_init( "read_regf_block" )) ) {
 		regfio_close( rb );
+		SAFE_FREE(rb);
 		return NULL;
 	}
 
@@ -1181,6 +1182,7 @@ out:
 	if ( (rb->fd = open(filename, flags, mode)) == -1 ) {
 		DEBUG(0,("regfio_open: failure to open %s (%s)\n", filename, strerror(errno)));
 		regfio_close( rb );
+		SAFE_FREE(rb);
 		return NULL;
 	}
 	
@@ -1190,6 +1192,7 @@ out:
 		if ( !init_regf_block( rb ) ) {
 			DEBUG(0,("regfio_open: Failed to read initial REGF block\n"));
 			regfio_close( rb );
+			SAFE_FREE(rb);
 			return NULL;
 		}
 		
@@ -1202,6 +1205,7 @@ out:
 	if ( !read_regf_block( rb ) ) {
 		DEBUG(0,("regfio_open: Failed to read initial REGF block\n"));
 		regfio_close( rb );
+		SAFE_FREE(rb);
 		return NULL;
 	}
 	
diff --git a/source/utils/profiles.c b/source/utils/profiles.c
index 7c7b91a..921af56 100644
--- a/source/utils/profiles.c
+++ b/source/utils/profiles.c
@@ -138,6 +138,7 @@ static BOOL copy_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk,
 	}
 
 	if ( !(values = TALLOC_ZERO_P( subkeys, REGVAL_CTR )) ) {
+		TALLOC_FREE( subkeys );
 		DEBUG(0,("copy_registry_tree: talloc() failure!\n"));
 		return False;
 	}
@@ -163,8 +164,10 @@ static BOOL copy_registry_tree( REGF_FILE *infile, REGF_NK_REC *nk,
 	
 	nk->subkey_index = 0;
 	while ( (subkey = regfio_fetch_subkey( infile, nk )) ) {
-		if ( !copy_registry_tree( infile, subkey, key, outfile, path ) )
+		if ( !copy_registry_tree( infile, subkey, key, outfile, path ) ) {
+			TALLOC_FREE( subkeys );
 			return False;
+		}
 	}
 
 	/* values is a talloc()'d child of subkeys here so just throw it all away */


-- 
Samba Shared Repository


More information about the samba-cvs mailing list