The 'idn_decode()' function now simply uses 'xstrdup()'.
And in host.c + connect.c there are calls to 'idn2_free()'
on this pointer:
if (opt.enable_iri && (name = idn_decode ((char *) print)) != NULL)
{
int len = strlen (print) + strlen (name) + 4;
str = xmalloc (len);
snprintf (str, len, "%s (%s)", name, print);
str[len-1] = '\0';
idn2_free (name); << !
}
Since the above 'name' is NOT from libidn, I get a crash when
mixing a MinGW built libidn2.dll with a MSVC built Wget.exe.
I think someone forgot to change the above code when 'idn_decode()'
got simplified. This patch works for me:
--- a/connect.c 2017-01-19 21:37:55
+++ b/connect.c 2017-04-08 09:57:24
@@ -284,7 +284,7 @@
str = xmalloc (len);
snprintf (str, len, "%s (%s)", name, print);
str[len-1] = '\0';
- idn2_free (name);
+ xfree (name);
}
logprintf (LOG_VERBOSE, _("Connecting to %s|%s|:%d... "),
--- a/host.c 2017-01-19 21:37:55
+++ b/host.c 2017-04-08 10:02:42
@@ -850,7 +850,7 @@
str = xmalloc (len);
snprintf (str, len, "%s (%s)", name, host);
str[len-1] = '\0';
- idn2_free (name);
+ xfree (name);
}
logprintf (LOG_VERBOSE, _("Resolving %s... "),
--gv