TALLOC_CTX *mem_ctx,
ADS_STRUCT **adsp)
{
+ TALLOC_CTX *tmp_ctx = talloc_stackframe();
ADS_STRUCT *ads;
ADS_STATUS status;
struct sockaddr_storage dc_ss;
enum credentials_use_kerberos krb5_state;
if (auth_realm == NULL) {
+ TALLOC_FREE(tmp_ctx);
return ADS_ERROR_NT(NT_STATUS_UNSUCCESSFUL);
}
ADS_SASL_SEAL);
if (!ads) {
DEBUG(1,("ads_init for domain %s failed\n", target_dom_name));
- return ADS_ERROR(LDAP_NO_MEMORY);
+ status = ADS_ERROR(LDAP_NO_MEMORY);
+ goto out;
}
SAFE_FREE(ads->auth.password);
ads->auth.realm = SMB_STRDUP(auth_realm);
if (!strupper_m(ads->auth.realm)) {
ads_destroy(&ads);
- return ADS_ERROR_NT(NT_STATUS_INTERNAL_ERROR);
+ status = ADS_ERROR_NT(NT_STATUS_INTERNAL_ERROR);
+ goto out;
}
/* Setup the server affinity cache. We don't reaally care
DEBUG(1,("ads_connect for domain %s failed: %s\n",
target_dom_name, ads_errstr(status)));
ads_destroy(&ads);
- return status;
+ goto out;
}
/* set the flag that says we don't own the memory even
ads->is_mine = False;
*adsp = ads;
-
+out:
+ TALLOC_FREE(tmp_ctx);
return status;
}