summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-04-03 15:02:40 +0200
committerVolker Lendecke <vl@samba.org>2010-04-19 14:27:19 +0200
commitf3e87ecd2c18c5ed56fa018925685d10f9804af0 (patch)
treeb3fd5a0802985335bffaded1f26f0b3e59ea2f6e
parent7f454c3078d27d14395fbb9b38a08b869e49d6a6 (diff)
downloadsamba-f3e87ecd2c18c5ed56fa018925685d10f9804af0.tar.gz
samba-f3e87ecd2c18c5ed56fa018925685d10f9804af0.tar.bz2
samba-f3e87ecd2c18c5ed56fa018925685d10f9804af0.zip
libwbclient: Make wbcDomainInfo not use talloc
-rw-r--r--nsswitch/libwbclient/wbc_util.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/nsswitch/libwbclient/wbc_util.c b/nsswitch/libwbclient/wbc_util.c
index 958d44413e..4e2c4557d7 100644
--- a/nsswitch/libwbclient/wbc_util.c
+++ b/nsswitch/libwbclient/wbc_util.c
@@ -132,6 +132,12 @@ done:
return wbc_status;
}
+static void wbcDomainInfoDestructor(void *ptr)
+{
+ struct wbcDomainInfo *i = (struct wbcDomainInfo *)ptr;
+ free(i->short_name);
+ free(i->dns_name);
+}
/** @brief Lookup the current status of a trusted domain, sync wrapper
*
@@ -166,15 +172,14 @@ wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo)
&response);
BAIL_ON_WBC_ERROR(wbc_status);
- info = talloc(NULL, struct wbcDomainInfo);
+ info = (struct wbcDomainInfo *)wbcAllocateMemory(
+ sizeof(struct wbcDomainInfo), 1, wbcDomainInfoDestructor);
BAIL_ON_PTR_ERROR(info, wbc_status);
- info->short_name = talloc_strdup(info,
- response.data.domain_info.name);
+ info->short_name = strdup(response.data.domain_info.name);
BAIL_ON_PTR_ERROR(info->short_name, wbc_status);
- info->dns_name = talloc_strdup(info,
- response.data.domain_info.alt_name);
+ info->dns_name = strdup(response.data.domain_info.alt_name);
BAIL_ON_PTR_ERROR(info->dns_name, wbc_status);
wbc_status = wbcStringToSid(response.data.domain_info.sid,
@@ -189,14 +194,12 @@ wbcErr wbcDomainInfo(const char *domain, struct wbcDomainInfo **dinfo)
info->domain_flags |= WBC_DOMINFO_DOMAIN_PRIMARY;
*dinfo = info;
+ info = NULL;
wbc_status = WBC_ERR_SUCCESS;
done:
- if (!WBC_ERROR_IS_OK(wbc_status)) {
- talloc_free(info);
- }
-
+ wbcFreeMemory(info);
return wbc_status;
}