[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-1222-gf93fc81

Michael Adam obnox at samba.org
Wed Jan 9 10:26:01 GMT 2008


The branch, v3-2-test has been updated
       via  f93fc818143a7442a6e8a90f16f60c536a5b8f9e (commit)
      from  9e736aab07b91744d4c14a55f6f7c55f51dd80f6 (commit)

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


- Log -----------------------------------------------------------------
commit f93fc818143a7442a6e8a90f16f60c536a5b8f9e
Author: Michael Adam <obnox at samba.org>
Date:   Wed Jan 9 11:22:29 2008 +0100

    Fix memory handling in torture/cmd_vfs.c:cmd_open and don't leak fsp_name.
    
    Michael

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

Summary of changes:
 source/torture/cmd_vfs.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/torture/cmd_vfs.c b/source/torture/cmd_vfs.c
index fbf9c3c..e349df6 100644
--- a/source/torture/cmd_vfs.c
+++ b/source/torture/cmd_vfs.c
@@ -279,14 +279,27 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c
 	}
 
 	fsp = SMB_MALLOC_P(struct files_struct);
+	if (fsp == NULL) {
+		return NT_STATUS_NO_MEMORY;
+	}
 	fsp->fsp_name = SMB_STRDUP(argv[1]);
+	if (fsp->fsp_name == NULL) {
+		SAFE_FREE(fsp);
+		return NT_STATUS_NO_MEMORY;
+	}
 	fsp->fh = SMB_MALLOC_P(struct fd_handle);
+	if (fsp->fh == NULL) {
+		SAFE_FREE(fsp->fsp_name);
+		SAFE_FREE(fsp);
+		return NT_STATUS_NO_MEMORY;
+	}
 	fsp->conn = vfs->conn;
 
 	fsp->fh->fd = SMB_VFS_OPEN(vfs->conn, argv[1], fsp, flags, mode);
 	if (fsp->fh->fd == -1) {
 		printf("open: error=%d (%s)\n", errno, strerror(errno));
 		SAFE_FREE(fsp->fh);
+		SAFE_FREE(fsp->fsp_name);
 		SAFE_FREE(fsp);
 		return NT_STATUS_UNSUCCESSFUL;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list