svn commit: samba r12099 - in trunk: . examples/libsmbclient source/libsmb

derrell at samba.org derrell at samba.org
Tue Dec 6 17:11:52 GMT 2005


Author: derrell
Date: 2005-12-06 17:11:51 +0000 (Tue, 06 Dec 2005)
New Revision: 12099

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

Log:
 r10800 at cabra:  derrell | 2005-12-06 12:11:41 -0500
 fix memory leak

Modified:
   trunk/
   trunk/examples/libsmbclient/Makefile
   trunk/source/libsmb/libsmbclient.c


Changeset:

Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 3a72dc49-98ff-0310-ab52-9b7ed7945d91:/local/samba-trunk:10795
   + 3a72dc49-98ff-0310-ab52-9b7ed7945d91:/local/samba-trunk:10800

Modified: trunk/examples/libsmbclient/Makefile
===================================================================
--- trunk/examples/libsmbclient/Makefile	2005-12-06 17:09:44 UTC (rev 12098)
+++ trunk/examples/libsmbclient/Makefile	2005-12-06 17:11:51 UTC (rev 12099)
@@ -15,6 +15,7 @@
 	tree \
 	testacl \
 	testbrowse \
+	testbrowse2 \
 	teststat \
 	testchmod \
 	testutime \
@@ -38,6 +39,10 @@
 	@echo Linking testbrowse
 	@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ -lsmbclient -lpopt $<
 
+testbrowse2: testbrowse2.o
+	@echo Linking testbrowse2
+	@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ -lsmbclient -lpopt $<
+
 teststat: teststat.o
 	@echo Linking teststat
 	@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ /usr/local/samba/lib/libsmbclient.so -lpopt $<

Modified: trunk/source/libsmb/libsmbclient.c
===================================================================
--- trunk/source/libsmb/libsmbclient.c	2005-12-06 17:09:44 UTC (rev 12098)
+++ trunk/source/libsmb/libsmbclient.c	2005-12-06 17:11:51 UTC (rev 12099)
@@ -483,6 +483,8 @@
 	DEBUG(3, ("smbc_remove_usused_server: %p removed.\n", srv));
 
 	context->callbacks.remove_cached_srv_fn(context, srv);
+
+        SAFE_FREE(srv);
 	
 	return 0;
 }
@@ -822,9 +824,9 @@
 	SMBCSRV *ipc_srv=NULL;
 
         /*
-         * See if we've already created this special connection.  Reference our
-         * "special" share name '*IPC$', which is an impossible real share name
-         * due to the leading asterisk.
+         * See if we've already created this special connection.  Reference
+         * our "special" share name '*IPC$', which is an impossible real share
+         * name due to the leading asterisk.
          */
         ipc_srv = find_server(context, server, "*IPC$",
                               workgroup, username, password);
@@ -2386,14 +2388,11 @@
 
                         /* Now, list the stuff ... */
                         
-                        if (!cli_NetServerEnum(&srv->cli, workgroup, SV_TYPE_DOMAIN_ENUM, list_unique_wg_fn,
+                        if (!cli_NetServerEnum(&srv->cli,
+                                               workgroup,
+                                               SV_TYPE_DOMAIN_ENUM,
+                                               list_unique_wg_fn,
                                                (void *)dir)) {
-                                
-                                if (dir) {
-                                        SAFE_FREE(dir->fname);
-                                        SAFE_FREE(dir);
-                                }
-
                                 continue;
                         }
                 }



More information about the samba-cvs mailing list