svn commit: samba r2083 - in branches/SAMBA_3_0/source/smbd: .

jra at samba.org jra at samba.org
Fri Aug 27 01:16:26 GMT 2004


Author: jra
Date: 2004-08-27 01:16:25 +0000 (Fri, 27 Aug 2004)
New Revision: 2083

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_3_0/source/smbd&rev=2083&nolog=1

Log:
Fix memleak on return code path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/smbd/open.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/open.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/open.c	2004-08-26 21:39:10 UTC (rev 2082)
+++ branches/SAMBA_3_0/source/smbd/open.c	2004-08-27 01:16:25 UTC (rev 2083)
@@ -592,7 +592,7 @@
 	int i;
 	int num_share_modes;
 	int oplock_contention_count = 0;
-	share_mode_entry *old_shares = 0;
+	share_mode_entry *old_shares = NULL;
 	BOOL fcbopen = False;
 	BOOL broke_oplock;
 
@@ -601,12 +601,15 @@
 	
 	num_share_modes = get_share_modes(conn, dev, inode, &old_shares);
 	
-	if(num_share_modes == 0)
+	if(num_share_modes == 0) {
+		SAFE_FREE(old_shares);
 		return 0;
+	}
 	
 	if (desired_access && ((desired_access & ~(SYNCHRONIZE_ACCESS|FILE_READ_ATTRIBUTES|FILE_WRITE_ATTRIBUTES))==0) &&
 		((desired_access & (SYNCHRONIZE_ACCESS|FILE_READ_ATTRIBUTES|FILE_WRITE_ATTRIBUTES)) != 0)) {
 		/* Stat open that doesn't trigger oplock breaks or share mode checks... ! JRA. */
+		SAFE_FREE(old_shares);
 		return num_share_modes;
 	}
 
@@ -758,9 +761,6 @@
 		free_broken_entry_list(broken_entry_list);
 	} while(broke_oplock);
 	
-	if(old_shares != 0)
-		SAFE_FREE(old_shares);
-	
 	/*
 	 * Refuse to grant an oplock in case the contention limit is
 	 * reached when going through the lock list multiple times.
@@ -772,6 +772,7 @@
 			 oplock_contention_count ));
 	}
 	
+	SAFE_FREE(old_shares);
 	return num_share_modes;
 }
 



More information about the samba-cvs mailing list