bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-wget] Misuse of idn2_free()


From: Gisle Vanem
Subject: Re: [Bug-wget] Misuse of idn2_free()
Date: Sat, 8 Apr 2017 11:52:59 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

Tim Rühsen wrote:

Thanks, Gisle.

pushed with several additional fixes/cleanups regarding idn2.

Too much cleanups I guess since it's crashing because no
'idn2_free()' called when needed. This works here:

--- a/url.c 2017-04-08 11:24:21
+++ b/url.c 2017-04-08 11:38:37
@@ -944,6 +944,7 @@
             {
               xfree (u->host);
               u->host = new;
+              u->idn_allocated = true;
               host_modified = true;
             }
         }
@@ -1222,6 +1223,9 @@
 {
   if (url)
     {
+      if (url->idn_allocated)
+        idn2_free (url->host);
+      else
       xfree (url->host);

       xfree (url->path);

--- a/url.h 2017-04-08 11:24:21
+++ b/url.h 2017-04-08 11:35:26
@@ -84,6 +84,7 @@
   enum url_scheme scheme;   /* URL scheme */

   char *host;               /* Extracted hostname */
+  bool idn_allocated;       /* 'host' allocated by libidn2 */
   int port;                 /* Port number */

-----------

--
--gv



reply via email to

[Prev in Thread] Current Thread [Next in Thread]