[SCM] Samba Shared Repository - branch v3-6-test updated

Volker Lendecke vlendec at samba.org
Thu Mar 24 10:55:42 MDT 2011


The branch, v3-6-test has been updated
       via  2896698 s3: Fix some errno assignments in SMBC_opendir_ctx
       via  6b44ca9 s3: Fix Coverity ID 2325: RESOURCE_LEAK (cherry picked from commit 9db92bb7f9ab9461019ebbf5839c588e2d16f229)
      from  73a5c6c s3-epmapper: Log error if we can't register the endpoint.

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


- Log -----------------------------------------------------------------
commit 289669878889d9440ac6b638aacb0fddf4e0e2c4
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Mar 24 16:03:13 2011 +0100

    s3: Fix some errno assignments in SMBC_opendir_ctx
    
    Do the assignment as the last action to make sure it's not overwritten
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Thu Mar 24 17:31:57 CET 2011 on sn-devel-104
    (cherry picked from commit 155c4fbc10ce3f47428402efd30eec732ab7a803)

commit 6b44ca993ad69ea219bb84b0e6a475b325605a02
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Mar 24 15:59:55 2011 +0100

    s3: Fix Coverity ID 2325: RESOURCE_LEAK
    (cherry picked from commit 9db92bb7f9ab9461019ebbf5839c588e2d16f229)

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

Summary of changes:
 source3/libsmb/libsmb_dir.c |   30 +++++++++++++++++-------------
 1 files changed, 17 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 9f249a9..d46f72a 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -383,16 +383,16 @@ SMBC_opendir_ctx(SMBCCTX *context,
 
 	if (!context || !context->internal->initialized) {
 	        DEBUG(4, ("no valid context\n"));
-		errno = EINVAL + 8192;
 		TALLOC_FREE(frame);
+		errno = EINVAL + 8192;
 		return NULL;
 
 	}
 
 	if (!fname) {
 		DEBUG(4, ("no valid fname\n"));
-		errno = EINVAL + 8193;
 		TALLOC_FREE(frame);
+		errno = EINVAL + 8193;
 		return NULL;
 	}
 
@@ -407,8 +407,8 @@ SMBC_opendir_ctx(SMBCCTX *context,
                             &password,
                             &options)) {
 	        DEBUG(4, ("no valid path\n"));
-		errno = EINVAL + 8194;
 		TALLOC_FREE(frame);
+		errno = EINVAL + 8194;
 		return NULL;
 	}
 
@@ -419,16 +419,16 @@ SMBC_opendir_ctx(SMBCCTX *context,
         /* Ensure the options are valid */
         if (SMBC_check_options(server, share, path, options)) {
                 DEBUG(4, ("unacceptable options (%s)\n", options));
-                errno = EINVAL + 8195;
 		TALLOC_FREE(frame);
+                errno = EINVAL + 8195;
                 return NULL;
         }
 
 	if (!user || user[0] == (char)0) {
 		user = talloc_strdup(frame, smbc_getUser(context));
 		if (!user) {
-			errno = ENOMEM;
 			TALLOC_FREE(frame);
+			errno = ENOMEM;
 			return NULL;
 		}
 	}
@@ -436,8 +436,8 @@ SMBC_opendir_ctx(SMBCCTX *context,
 	dir = SMB_MALLOC_P(SMBCFILE);
 
 	if (!dir) {
-		errno = ENOMEM;
 		TALLOC_FREE(frame);
+		errno = ENOMEM;
 		return NULL;
 	}
 
@@ -461,12 +461,12 @@ SMBC_opendir_ctx(SMBCCTX *context,
 
 		if (share[0] != (char)0 || path[0] != (char)0) {
 
-			errno = EINVAL + 8196;
 			if (dir) {
 				SAFE_FREE(dir->fname);
 				SAFE_FREE(dir);
 			}
 			TALLOC_FREE(frame);
+			errno = EINVAL + 8196;
 			return NULL;
 		}
 
@@ -509,16 +509,16 @@ SMBC_opendir_ctx(SMBCCTX *context,
 					SAFE_FREE(dir->fname);
 					SAFE_FREE(dir);
 				}
-                                errno = ENOENT;
 				TALLOC_FREE(frame);
+                                errno = ENOENT;
                                 return NULL;
                         }
 
 			ip_list = (struct ip_service *)memdup(
 				&server_addr, sizeof(server_addr));
 			if (ip_list == NULL) {
-				errno = ENOMEM;
 				TALLOC_FREE(frame);
+				errno = ENOMEM;
 				return NULL;
 			}
                         count = 1;
@@ -550,8 +550,12 @@ SMBC_opendir_ctx(SMBCCTX *context,
                         cli_shutdown(cli);
 
 			if (!workgroup || !server) {
-				errno = ENOMEM;
+				if (dir) {
+					SAFE_FREE(dir->fname);
+					SAFE_FREE(dir);
+				}
 				TALLOC_FREE(frame);
+				errno = ENOMEM;
 				return NULL;
 			}
 
@@ -595,12 +599,12 @@ SMBC_opendir_ctx(SMBCCTX *context,
 			if (*path != '\0') {
 
                                 /* Should not have empty share with path */
-				errno = EINVAL + 8197;
 				if (dir) {
 					SAFE_FREE(dir->fname);
 					SAFE_FREE(dir);
 				}
 				TALLOC_FREE(frame);
+				errno = EINVAL + 8197;
 				return NULL;
 
 			}
@@ -658,8 +662,8 @@ SMBC_opendir_ctx(SMBCCTX *context,
 						SAFE_FREE(dir->fname);
 						SAFE_FREE(dir);
 					}
-					errno = EPERM;
 					TALLOC_FREE(frame);
+					errno = EPERM;
 					return NULL;
 
 				}
@@ -859,8 +863,8 @@ SMBC_opendir_ctx(SMBCCTX *context,
                                         }
                                 }
 
-                                errno = saved_errno;
 				TALLOC_FREE(frame);
+                                errno = saved_errno;
 				return NULL;
 			}
 		}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list