Hi Micah & devs ,

I find  two places may cause memory leak in http.c . When Http
Authorization failed, the function returned without free resp.

And it seems that it has never been fixed since an early version.

Regards,
Xin Zou


Below is patch for the newest code checked out from Mercurial
----------------------------------------------------
--- wget.orig/src/http.c        2008-12-31 12:39:03.000000000 +0800
+++ wget/src/http.c     2009-01-07 22:01:21.000000000 +0800
@@ -1885,6 +1885,7 @@
                   register_basic_auth_host (u->host);
                 }
               xfree (pth);
+              resp_free (resp);
               goto retry_with_auth;
             }
           else
@@ -1895,6 +1896,7 @@
         }
       logputs (LOG_NOTQUIET, _("Authorization failed.\n"));
       request_free (req);
+      resp_free (resp);
       return AUTHFAILED;
     }
   else /* statcode != HTTP_STATUS_UNAUTHORIZED */


Reply via email to