s3: Do an early TALLOC_FREE
authorVolker Lendecke <vl@samba.org>
Mon, 28 Jun 2010 09:20:23 +0000 (11:20 +0200)
committerVolker Lendecke <vl@samba.org>
Mon, 28 Jun 2010 11:54:44 +0000 (13:54 +0200)
source3/winbindd/winbindd_ads.c

index 00b53a205c40cb109a32e65cc04159817bb4dc92..2b63c43003ddabbe6397be6de3fd720decb38fd6 100644 (file)
@@ -464,6 +464,7 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
        NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
        struct netr_SamInfo3 *user = NULL;
        gid_t gid;
+       int ret;
 
        DEBUG(3,("ads: query_user\n"));
 
@@ -527,13 +528,15 @@ static NTSTATUS query_user(struct winbindd_domain *domain,
        }
 
        sidstr = sid_binstring(talloc_tos(), sid);
-       if (asprintf(&ldap_exp, "(objectSid=%s)", sidstr) == -1) {
+
+       ret = asprintf(&ldap_exp, "(objectSid=%s)", sidstr);
+       TALLOC_FREE(sidstr);
+       if (ret == -1) {
                status = NT_STATUS_NO_MEMORY;
                goto done;
        }
        rc = ads_search_retry(ads, &msg, ldap_exp, attrs);
        free(ldap_exp);
-       TALLOC_FREE(sidstr);
        if (!ADS_ERR_OK(rc) || !msg) {
                DEBUG(1,("query_user(sid=%s) ads_search: %s\n",
                         sid_string_dbg(sid), ads_errstr(rc)));