From 3bff11407e721a4a01b67881862d2a466ec5d103 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 5 May 2006 15:54:11 +0000 Subject: r15461: Free LDAP result in ads_get_attrname_by_oid(). Guenther (This used to be commit f4af888282ff39665f186550b9ccbbf7a9128fc2) --- source3/libads/ldap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 81aa9051d7..a8877b5697 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -2471,6 +2471,7 @@ const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const void *res = NULL; char *expr = NULL; const char *attrs[] = { "lDAPDisplayName", NULL }; + char *result; if (ads == NULL || mem_ctx == NULL || OID == NULL) { goto failed; @@ -2492,12 +2493,16 @@ const char *ads_get_attrname_by_oid(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx, const goto failed; } - return ads_pull_string(ads, mem_ctx, res, "lDAPDisplayName"); + result = ads_pull_string(ads, mem_ctx, res, "lDAPDisplayName"); + ads_msgfree(ads, res); + + return result; failed: DEBUG(0,("ads_get_attrname_by_oid: failed to retrieve name for oid: %s\n", OID)); + ads_msgfree(ads, res); return NULL; } -- cgit