[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2473-g737bb95

Jeremy Allison jra at samba.org
Thu Feb 21 02:30:46 GMT 2008


The branch, v3-2-test has been updated
       via  737bb950d50ac6c5d4f99279bf535ae3a9963b2f (commit)
       via  47dd0700b4320bf5ac9a80e71ae82d82d4554e6a (commit)
      from  f7d2f692994918037e603ef95dd097b03d2c5456 (commit)

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


- Log -----------------------------------------------------------------
commit 737bb950d50ac6c5d4f99279bf535ae3a9963b2f
Author: Tim Potter <tpot at samba.org>
Date:   Mon Feb 18 20:37:33 2008 +1100

    Fix double free bugs after calling regfio_close()

commit 47dd0700b4320bf5ac9a80e71ae82d82d4554e6a
Author: Tim Potter <tpot at samba.org>
Date:   Mon Feb 18 21:00:51 2008 +1100

    Fix memory leaks on error path

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

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


Changeset truncated at 500 lines:

diff --git a/source/libsmb/clifile.c b/source/libsmb/clifile.c
index 9b4c380..10c35a3 100644
--- a/source/libsmb/clifile.c
+++ b/source/libsmb/clifile.c
@@ -38,8 +38,15 @@ static bool cli_link_internal(struct cli_state *cli, const char *oldname, const
 	size_t newlen = 2*(strlen(newname)+1);
 
 	param = SMB_MALLOC_ARRAY(char, 6+newlen+2);
+
+	if (!param) {
+		return false;
+	}
+
 	data = SMB_MALLOC_ARRAY(char, oldlen+2);
-	if (!param || !data) {
+
+	if (!data) {
+		SAFE_FREE(param);
 		return false;
 	}
 
diff --git a/source/registry/regfio.c b/source/registry/regfio.c
index 3740ff0..1c3aad7 100644
--- a/source/registry/regfio.c
+++ b/source/registry/regfio.c
@@ -1171,7 +1171,6 @@ out:
 	
 	if ( !(rb->mem_ctx = talloc_init( "read_regf_block" )) ) {
 		regfio_close( rb );
-		SAFE_FREE(rb);
 		return NULL;
 	}
 
@@ -1182,7 +1181,6 @@ 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;
 	}
 	
@@ -1192,7 +1190,6 @@ 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;
 		}
 		
@@ -1205,7 +1202,6 @@ 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;
 	}
 	


-- 
Samba Shared Repository


More information about the samba-cvs mailing list