yet another one; Other memory leaks in winbind.

kawasa_r at itg.hitachi.co.jp kawasa_r at itg.hitachi.co.jp
Mon May 17 09:57:50 GMT 2004


In addition to a previously posted case, we've found another one.
----------------------------------------------------

Other memory leaks in ldap.c. In the following patch, some 'free's
are added.

Index: samba-302/source/libads/ldap.c
===================================================================
RCS file: /cvs/samba-302/source/libads/ldap.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- samba-302/source/libads/ldap.c	16 Apr 2004 00:45:23 -0000	1.4
+++ samba-302/source/libads/ldap.c	16 Apr 2004 00:54:43 -0000	1.5
@@ -2004,17 +2004,22 @@
 	}
 
 	status = ads_do_search(ads, "", LDAP_SCOPE_BASE, "(objectclass=*)", attrs, &res);
-	if (!ADS_ERR_OK(status)) return status;
+	if (!ADS_ERR_OK(status)) {
+		talloc_destroy(ctx);
+		return status;
+	}
 
 	value = ads_pull_string(ads, ctx, res, "ldapServiceName");
 	if (!value) {
 		ads_msgfree(ads, res);
+		talloc_destroy(ctx);
 		return ADS_ERROR(LDAP_NO_RESULTS_RETURNED);
 	}
 
 	timestr = ads_pull_string(ads, ctx, res, "currentTime");
 	if (!timestr) {
 		ads_msgfree(ads, res);
+		talloc_destroy(ctx);
 		return ADS_ERROR(LDAP_NO_RESULTS_RETURNED);
 	}
 





More information about the samba-technical mailing list