summaryrefslogtreecommitdiffstats
path: root/source/libads
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2006-03-12 19:56:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:15:21 -0500
commit37b6e2c8de41754a5a1a3a6f798d57aa5d533ada (patch)
treee035b8fa87966a0c4448b34abbdda759dce78c81 /source/libads
parentca96c7be778d01594a540917acd3c5c218d6459c (diff)
downloadsamba-37b6e2c8de41754a5a1a3a6f798d57aa5d533ada.tar.gz
samba-37b6e2c8de41754a5a1a3a6f798d57aa5d533ada.tar.xz
samba-37b6e2c8de41754a5a1a3a6f798d57aa5d533ada.zip
r14252: Fix Coverity #72: free alloc'ed storage before return. Also found one
more that coverity didn't find from asprintf.
Diffstat (limited to 'source/libads')
-rw-r--r--source/libads/ldap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source/libads/ldap.c b/source/libads/ldap.c
index dd49c706f46..e1cea533a0e 100644
--- a/source/libads/ldap.c
+++ b/source/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) )) {