winbindd: Avoid using deallocated memory
authorSantosh Kumar Pradhan <spradhan@redhat.com>
Thu, 20 Feb 2014 10:21:37 +0000 (15:51 +0530)
committerJeremy Allison <jra@samba.org>
Thu, 20 Feb 2014 19:41:51 +0000 (11:41 -0800)
Failure in ads_search_retry() deallocates the memory occupied
by "ads" which should not be used after.

CID: 242096

Signed-off-by: Santosh Kumar Pradhan <spradhan@redhat.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
source3/winbindd/winbindd_ads.c

index 18749c97c461685cd00f1274412c91b7dda749b1..4f149a757bebf75b763cc4fd0aa2feb5fb923f3d 100644 (file)
@@ -297,9 +297,9 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
        if (!ADS_ERR_OK(rc)) {
                DEBUG(1,("query_user_list ads_search: %s\n", ads_errstr(rc)));
                status = ads_ntstatus(rc);
+               goto done;
        } else if (!res) {
                DEBUG(1,("query_user_list ads_search returned NULL res\n"));
-
                goto done;
        }