summaryrefslogtreecommitdiff
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
commit06f7ee5d4b9d2f94c0178a0c979f50fa2f96b905 (patch)
treef572f625d8851a82b3974988a54e14d7b7967b61
parent05b4d0b38e53de20b7aad2bbb3c6a6788d23313f (diff)
downloadsamba-06f7ee5d4b9d2f94c0178a0c979f50fa2f96b905.tar.gz
samba-06f7ee5d4b9d2f94c0178a0c979f50fa2f96b905.tar.bz2
samba-06f7ee5d4b9d2f94c0178a0c979f50fa2f96b905.zip
r14252: Fix Coverity #72: free alloc'ed storage before return. Also found one
more that coverity didn't find from asprintf. (This used to be commit 37b6e2c8de41754a5a1a3a6f798d57aa5d533ada)
-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) )) {