idn: fix memory leak in win32_ascii_to_idn()

Closes #19789
This commit is contained in:
Viktor Szakats 2025-12-01 15:52:10 +01:00
parent c421c3e325
commit ca1919caee
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201

View file

@ -201,6 +201,7 @@ static CURLcode win32_ascii_to_idn(const char *in, char **output)
WCHAR idn[IDN_MAX_LENGTH]; /* stores a UTF-16 string */
int chars = IdnToUnicode(0, in_w, (int)(wcslen(in_w) + 1), idn,
IDN_MAX_LENGTH);
curlx_unicodefree(in_w);
if(chars) {
/* 'chars' is "the number of characters retrieved" */
char *mstr = curlx_convert_wchar_to_UTF8(idn);