changeset 885:5c39e702d920

Fixed a leak in Html_tag_open_link()
author Jeremy Henty <onepoint@starurchin.org>
date Sun, 01 Feb 2009 14:16:26 -0300
parents 8d747af3b6d7
children 2769f29bf2b8
files ChangeLog src/html.cc
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Jan 31 18:01:27 2009 -0300
+++ b/ChangeLog	Sun Feb 01 14:16:26 2009 -0300
@@ -32,6 +32,7 @@
  - Cleaned up and normalized D_SUN_LEN usage.
  - Fixed incorrect use of VOIDP2INT in Dialog_user_password_cb().
  - Ensure that the dlib dStr* functions are used everywhere.
+ - Fixed a leak in Html_tag_open_link().
    Patches: Jeremy Henty
 +- Implemented Basic authentication!
    Patch: Jeremy Henty, Jorge Arellano Cid
--- a/src/html.cc	Sat Jan 31 18:01:27 2009 -0300
+++ b/src/html.cc	Sun Feb 01 14:16:26 2009 -0300
@@ -2850,11 +2850,10 @@
       return;
 
    /* CSS stylesheet link */
-   if ((!(attrbuf = a_Html_get_attr(html, tag, tagsize, "rel")) ||
-        dStrcasecmp(attrbuf, "stylesheet")) ||
-       (!(attrbuf = a_Html_get_attr(html, tag, tagsize, "href")) ||
-        !(url = a_Html_url_new(html, attrbuf, NULL, 0))))
+   if (!(attrbuf = a_Html_get_attr(html, tag, tagsize, "rel")) ||
+       dStrcasecmp(attrbuf, "stylesheet"))
       return;
+
    /* IMPLIED attributes? */
    if (((attrbuf = a_Html_get_attr(html, tag, tagsize, "type")) &&
         dStrcasecmp(attrbuf, "text/css")) ||
@@ -2862,6 +2861,10 @@
         !dStristr(attrbuf, "screen") && dStrcasecmp(attrbuf, "all")))
       return;
 
+   if (!(attrbuf = a_Html_get_attr(html, tag, tagsize, "href")) ||
+       !(url = a_Html_url_new(html, attrbuf, NULL, 0)))
+      return;
+
    MSG("  Html_tag_open_link(): URL=%s\n", URL_STR(url));
    _MSG("    repush after HEAD=%d\n", html->repush_after_head);