summaryrefslogtreecommitdiff
path: root/source/libads/ads_struct.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-12-05 06:26:56 +0000
committerAndrew Tridgell <tridge@samba.org>2001-12-05 06:26:56 +0000
commiteb6f0e91ddd2a97a907a569bc60beca99b494884 (patch)
tree71c95382305c411bd497f747feeee497f49b1dc7 /source/libads/ads_struct.c
parent60b5d4432abd905ee61fe381487ed87139134685 (diff)
downloadsamba-eb6f0e91ddd2a97a907a569bc60beca99b494884.tar.gz
more memory leak fixes
Diffstat (limited to 'source/libads/ads_struct.c')
-rw-r--r--source/libads/ads_struct.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/libads/ads_struct.c b/source/libads/ads_struct.c
index 4227684375e..2d8bf061564 100644
--- a/source/libads/ads_struct.c
+++ b/source/libads/ads_struct.c
@@ -139,7 +139,7 @@ ADS_STRUCT *ads_init(const char *realm,
ADS_STRUCT *ads;
ads = (ADS_STRUCT *)smb_xmalloc(sizeof(*ads));
- memset(ads, 0, sizeof(*ads));
+ ZERO_STRUCTP(ads);
ads->realm = realm? strdup(realm) : NULL;
ads->ldap_server = ldap_server? strdup(ldap_server) : NULL;
@@ -147,7 +147,7 @@ ADS_STRUCT *ads_init(const char *realm,
ads->ldap_port = LDAP_PORT;
if (!ads->realm) {
- ads->realm = lp_realm();
+ ads->realm = strdup(lp_realm());
if (!ads->realm[0]) {
ads->realm = get_default_realm(ads);
}
@@ -157,7 +157,7 @@ ADS_STRUCT *ads_init(const char *realm,
ads->bind_path = ads_build_dn(ads->realm);
}
if (!ads->ldap_server) {
- ads->ldap_server = lp_ads_server();
+ ads->ldap_server = strdup(lp_ads_server());
if (!ads->ldap_server[0]) {
ads->ldap_server = find_ldap_server(ads);
}
@@ -175,7 +175,7 @@ ADS_STRUCT *ads_init(const char *realm,
*/
void ads_destroy(ADS_STRUCT **ads)
{
- if (False && (ads) && (*ads)) {
+ if (ads && *ads) {
if ((*ads)->ld) ldap_unbind((*ads)->ld);
SAFE_FREE((*ads)->realm);
SAFE_FREE((*ads)->ldap_server);