summaryrefslogtreecommitdiff
path: root/lib/ldap.c
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2021-04-23 00:21:16 -0400
committerJay Satiro <raysatiro@yahoo.com>2021-04-27 15:09:23 -0400
commit1d5d0ae9e579f7744fa6bb4d0e5fc489b0bbcfa0 (patch)
tree38c54dad9638094d8902250cd1d71793fb8df239 /lib/ldap.c
parent3e820fbf25f38743fd30e0ce96ba9ae34791aa7c (diff)
downloadcurl-1d5d0ae9e579f7744fa6bb4d0e5fc489b0bbcfa0.tar.gz
lib: fix some misuse of curlx_convert_UTF8_to_tchar
curlx_convert_UTF8_to_tchar must be freed by curlx_unicodefree, but prior to this change some uses mistakenly called free. I've reviewed all other uses of curlx_convert_UTF8_to_tchar and curlx_convert_tchar_to_UTF8. Bug: https://github.com/curl/curl/pull/6602#issuecomment-825236763 Reported-by: sergio-nsk@users.noreply.github.com Closes https://github.com/curl/curl/pull/6938
Diffstat (limited to 'lib/ldap.c')
-rw-r--r--lib/ldap.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/ldap.c b/lib/ldap.c
index 310a1e843..2f1032285 100644
--- a/lib/ldap.c
+++ b/lib/ldap.c
@@ -581,7 +581,7 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done)
result = CURLE_OUT_OF_MEMORY;
goto quit;
- }
+ }
#else
char *attr = attribute;
#endif
@@ -1061,13 +1061,23 @@ static void _ldap_free_urldesc(LDAPURLDesc *ludp)
if(!ludp)
return;
+#if defined(USE_WIN32_LDAP)
+ curlx_unicodefree(ludp->lud_dn);
+ curlx_unicodefree(ludp->lud_filter);
+#else
free(ludp->lud_dn);
free(ludp->lud_filter);
+#endif
if(ludp->lud_attrs) {
size_t i;
- for(i = 0; i < ludp->lud_attrs_dups; i++)
+ for(i = 0; i < ludp->lud_attrs_dups; i++) {
+#if defined(USE_WIN32_LDAP)
+ curlx_unicodefree(ludp->lud_attrs[i]);
+#else
free(ludp->lud_attrs[i]);
+#endif
+ }
free(ludp->lud_attrs);
}