r18165: Fix memleaks.
authorGünther Deschner <gd@samba.org>
Wed, 6 Sep 2006 12:14:58 +0000 (12:14 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:43:29 +0000 (11:43 -0500)
Guenther

source/libads/ldap.c

index 6c3ab75340cae67631727afe5447a96ac5dfccad..0b7ca46e3e9b588ee1f072ec113310f965054fa3 100644 (file)
@@ -2260,10 +2260,15 @@ ADS_STATUS ads_USN(ADS_STRUCT *ads, uint32 *usn)
                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 @@ ADS_STATUS ads_current_time(ADS_STRUCT *ads)
 
        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;
        }