svn commit: samba r17291 - in branches: SAMBA_3_0/source/libsmb SAMBA_3_0_23/source/libsmb

jra at samba.org jra at samba.org
Fri Jul 28 20:35:01 GMT 2006


Author: jra
Date: 2006-07-28 20:35:00 +0000 (Fri, 28 Jul 2006)
New Revision: 17291

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17291

Log:
Fix memory leaks on early exit path.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/libsmb/clidfs.c
   branches/SAMBA_3_0_23/source/libsmb/clidfs.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/clidfs.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/clidfs.c	2006-07-28 11:51:07 UTC (rev 17290)
+++ branches/SAMBA_3_0/source/libsmb/clidfs.c	2006-07-28 20:35:00 UTC (rev 17291)
@@ -713,12 +713,14 @@
 	res = cli_dfs_get_referral(cli, fullpath, &refs, &num_refs, &consumed);
 
 	if (!cli_tdis(cli)) {
+		SAFE_FREE( refs );
 		return False;
 	}
 
 	cli->cnum = cnum;
 		
 	if (!res || !num_refs ) {
+		SAFE_FREE( refs );
 		return False;
 	}
 	
@@ -726,8 +728,10 @@
 
 	/* check that this is not a self-referral */
 
-	if ( strequal( cli->desthost, newserver ) && strequal( sharename, newshare ) )
+	if ( strequal( cli->desthost, newserver ) && strequal( sharename, newshare ) ) {
+		SAFE_FREE( refs );
 		return False;
+	}
 	
 	SAFE_FREE( refs );
 	

Modified: branches/SAMBA_3_0_23/source/libsmb/clidfs.c
===================================================================
--- branches/SAMBA_3_0_23/source/libsmb/clidfs.c	2006-07-28 11:51:07 UTC (rev 17290)
+++ branches/SAMBA_3_0_23/source/libsmb/clidfs.c	2006-07-28 20:35:00 UTC (rev 17291)
@@ -712,12 +712,14 @@
 	res = cli_dfs_get_referral(cli, fullpath, &refs, &num_refs, &consumed);
 
 	if (!cli_tdis(cli)) {
+		SAFE_FREE( refs );
 		return False;
 	}
 
 	cli->cnum = cnum;
 		
 	if (!res || !num_refs ) {
+		SAFE_FREE( refs );
 		return False;
 	}
 	
@@ -725,8 +727,10 @@
 
 	/* check that this is not a self-referral */
 
-	if ( strequal( cli->desthost, newserver ) && strequal( sharename, newshare ) )
+	if ( strequal( cli->desthost, newserver ) && strequal( sharename, newshare ) ) {
+		SAFE_FREE( refs );
 		return False;
+	}
 	
 	SAFE_FREE( refs );
 	



More information about the samba-cvs mailing list