summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2006-03-09 20:51:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:11:12 -0500
commitd95efac94d6ea0ed539f3f6bde762dd479dbd599 (patch)
treefe3c079c0f126ac3230c93a1e81f51b84462eeb5 /source3/utils
parent10373355df7b4d83581589ce496d52bcbe4fefd8 (diff)
downloadsamba-d95efac94d6ea0ed539f3f6bde762dd479dbd599.tar.gz
samba-d95efac94d6ea0ed539f3f6bde762dd479dbd599.tar.bz2
samba-d95efac94d6ea0ed539f3f6bde762dd479dbd599.zip
r14099: Fix Coverity # 113
(This used to be commit db00570535c03360bb2833f070878a33e94306b0)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_ads.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index f54896b3a8..a55bc4fe56 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -367,15 +367,15 @@ static int ads_user_info(int argc, const char **argv)
}
escaped_user = escape_ldap_string_alloc(argv[0]);
-
- if (!(ads = ads_startup())) {
- return -1;
- }
if (!escaped_user) {
d_fprintf(stderr, "ads_user_info: failed to escape user %s\n", argv[0]);
- ads_destroy(&ads);
- return -1;
+ return -1;
+ }
+
+ if (!(ads = ads_startup())) {
+ SAFE_FREE(escaped_user);
+ return -1;
}
asprintf(&searchstring, "(sAMAccountName=%s)", escaped_user);
@@ -385,6 +385,7 @@ static int ads_user_info(int argc, const char **argv)
if (!ADS_ERR_OK(rc)) {
d_fprintf(stderr, "ads_search: %s\n", ads_errstr(rc));
ads_destroy(&ads);
+ SAFE_FREE(escaped_user);
return -1;
}
@@ -403,6 +404,7 @@ static int ads_user_info(int argc, const char **argv)
ads_msgfree(ads, res);
ads_destroy(&ads);
+ SAFE_FREE(escaped_user);
return 0;
}