1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

ldap: Fixed memory leak from commit efb64fdf80

The unescapped DN was not freed after a successful character conversion.
This commit is contained in:
Steve Holme 2015-01-04 14:11:02 +00:00
parent 825b0c7968
commit 7241527956

View File

@ -737,6 +737,7 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
LDAP_TRACE (("DN '%s'\n", dn)); LDAP_TRACE (("DN '%s'\n", dn));
/* Unescape the DN */
unescapped = curl_easy_unescape(conn->data, dn, 0, NULL); unescapped = curl_easy_unescape(conn->data, dn, 0, NULL);
if(!unescapped) { if(!unescapped) {
rc = LDAP_NO_MEMORY; rc = LDAP_NO_MEMORY;
@ -746,10 +747,13 @@ static int _ldap_url_parse2 (const struct connectdata *conn, LDAPURLDesc *ludp)
#if defined(CURL_LDAP_WIN) && \ #if defined(CURL_LDAP_WIN) && \
(defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI)) (defined(USE_WIN32_IDN) || defined(USE_WINDOWS_SSPI))
/* Convert the unescapped string to a tchar */
ludp->lud_dn = Curl_convert_UTF8_to_tchar(unescapped); 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; rc = LDAP_NO_MEMORY;
goto quit; goto quit;