summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2015-01-04 14:11:02 +0000
committerSteve Holme <steve_holme@hotmail.com>2015-01-04 14:21:29 +0000
commit724152795672089837ddda2ebde15d1113da6b1b (patch)
tree6b8fc122f55494752f5622a8c391ecbaf384b7a1
parent825b0c79689c8c3857bb3e26b48bfd706fe8c1c2 (diff)
downloadgnurl-724152795672089837ddda2ebde15d1113da6b1b.tar.gz
gnurl-724152795672089837ddda2ebde15d1113da6b1b.tar.bz2
gnurl-724152795672089837ddda2ebde15d1113da6b1b.zip
ldap: Fixed memory leak from commit efb64fdf80
The unescapped DN was not freed after a successful character conversion.
-rw-r--r--lib/ldap.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/ldap.c b/lib/ldap.c
index 66be12635..2b4b168ed 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -737,6 +737,7 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
LDAP_TRACE (("DN '%s'\n", dn));
+ /* Unescape the DN */
unescapped = curl_easy_unescape(conn->data, dn, 0, NULL);
if(!unescapped) {
rc = LDAP_NO_MEMORY;
@@ -746,10 +747,13 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
#if defined(CURL_LDAP_WIN) && \
(defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
+ /* Convert the unescapped string to a tchar */
ludp->lud_dn = Curl_convert_UTF8_to_tchar(unescapped);
- if(!ludp->lud_dn) {
- Curl_safefree(unescapped);
+ /* Free the unescapped string as we are done with it */
+ Curl_unicodefree(unescapped);
+
+ if(!ludp->lud_dn) {
rc = LDAP_NO_MEMORY;
goto quit;