Author: gd
Date: 2006-09-06 12:14:58 +0000 (Wed, 06 Sep 2006)
New Revision: 18165

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

Log:
Fix memleaks.

Guenther

Modified:
   branches/SAMBA_3_0/source/libads/ldap.c
   branches/SAMBA_3_0_23/source/libads/ldap.c


Changeset:
Modified: branches/SAMBA_3_0/source/libads/ldap.c
===================================================================
--- branches/SAMBA_3_0/source/libads/ldap.c     2006-09-06 12:12:42 UTC (rev 
18164)
+++ branches/SAMBA_3_0/source/libads/ldap.c     2006-09-06 12:14:58 UTC (rev 
18165)
@@ -2260,10 +2260,15 @@
                return status;
 
        if (ads_count_replies(ads, res) != 1) {
+               ads_msgfree(ads, res);
                return ADS_ERROR(LDAP_NO_RESULTS_RETURNED);
        }
 
-       ads_pull_uint32(ads, res, "highestCommittedUSN", usn);
+       if (!ads_pull_uint32(ads, res, "highestCommittedUSN", usn)) {
+               ads_msgfree(ads, res);
+               return ADS_ERROR(LDAP_NO_SUCH_ATTRIBUTE);
+       }
+
        ads_msgfree(ads, res);
        return ADS_SUCCESS;
 }
@@ -2325,7 +2330,7 @@
 
        timestr = ads_pull_string(ads_s, ctx, res, "currentTime");
        if (!timestr) {
-               ads_msgfree(ads, res);
+               ads_msgfree(ads_s, res);
                status = ADS_ERROR(LDAP_NO_RESULTS_RETURNED);
                goto done;
        }

Modified: branches/SAMBA_3_0_23/source/libads/ldap.c
===================================================================
--- branches/SAMBA_3_0_23/source/libads/ldap.c  2006-09-06 12:12:42 UTC (rev 
18164)
+++ branches/SAMBA_3_0_23/source/libads/ldap.c  2006-09-06 12:14:58 UTC (rev 
18165)
@@ -2183,10 +2183,15 @@
                return status;
 
        if (ads_count_replies(ads, res) != 1) {
+               ads_msgfree(ads, res);
                return ADS_ERROR(LDAP_NO_RESULTS_RETURNED);
        }
 
-       ads_pull_uint32(ads, res, "highestCommittedUSN", usn);
+       if (!ads_pull_uint32(ads, res, "highestCommittedUSN", usn)) {
+               ads_msgfree(ads, res);
+               return ADS_ERROR(LDAP_NO_SUCH_ATTRIBUTE);
+       }
+
        ads_msgfree(ads, res);
        return ADS_SUCCESS;
 }
@@ -2248,7 +2253,7 @@
 
        timestr = ads_pull_string(ads_s, ctx, res, "currentTime");
        if (!timestr) {
-               ads_msgfree(ads, res);
+               ads_msgfree(ads_s, res);
                status = ADS_ERROR(LDAP_NO_RESULTS_RETURNED);
                goto done;
        }

Reply via email to