summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/libads/ldap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
index dd49c706f4..e1cea533a0 100644
--- a/source3/libads/ldap.c
+++ b/source3/libads/ldap.c
@@ -1914,7 +1914,10 @@ ADS_STATUS ads_set_machine_sd(ADS_STRUCT *ads, const char *hostname, char *dn)
* we have to bail out before prs_init */
ps_wire.is_dynamic = False;
- if (!ads) return ADS_ERROR(LDAP_SERVER_DOWN);
+ if (!ads) {
+ SAFE_FREE(escaped_hostname);
+ return ADS_ERROR(LDAP_SERVER_DOWN);
+ }
ret = ADS_ERROR(LDAP_SUCCESS);
@@ -1932,6 +1935,8 @@ ADS_STATUS ads_set_machine_sd(ADS_STRUCT *ads, const char *hostname, char *dn)
ret = ads_search(ads, (void *) &res, expr, attrs);
+ SAFE_FREE(expr);
+
if (!ADS_ERR_OK(ret)) return ret;
if ( !(msg = ads_first_entry(ads, res) )) {