bugGNU Wget - Bugs: bug #42195, Content encoding string leaked

 
 

bug #42195: Content encoding string leaked

Submitter:  None
Submitted:  Fri 25 Apr 2014 11:27:25 AM UTC
   
 
Category:  Memory Leak Severity:  2 - Minor
Priority:  5 - Normal Status:  Fixed
Privacy:  Public Assigned to:  None
Originator Name:  Benjamin Goose Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  trunk
Operating System:  GNU/Linux Reproducibility:  Every Time
Fixed Release:  None Planned Release:  None
Regression:  None Work Required:  None
Patch Included:  Yes
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 02 May 2014 06:47:29 PM UTC, comment #2: 

Thanks for the reply. A new patch is attached.

(file #31299)

Anonymous
Thu 01 May 2014 07:58:17 AM UTC, comment #1: 

Hi,

Thanks for the report. The string indeed seems to be leaking.
But there's a couple of comments:

@@ -2596,6 +2596,7 @@ read_header:
               tmp = parse_charset (tmp2);
               if (tmp)
                 set_content_encoding (iri, tmp);
+                xfree_null(tmp);
             }
         }
     }

This patch seems ripe for the same kind of bug as apple goto fail in SSL. You've indented code at the same level as an if statement, even though it is not part of the conditional.

Also, would it not be better to free the pointer just outside of the if(tmp) {} block?

Could you please also write a ChangeLog entry for this so we can push it?

Darshit Shah <darnir>
Group administrator
Fri 25 Apr 2014 11:27:25 AM UTC, original submission:  
  • http.c:2596: parse_charset returns a pointer to a newly allocated string (with strdupdelim)
  • This is passed to set_content_encoding, which uses xstrdup to copy it again
  • The original string is not freed.


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #31299:  0001-Plug-memory-leak-2.patch added by None (887B - text/x-patch)
file #31246:  0001-Plug-memory-leak.patch added by None (575B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by darnir (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-06-08 darnir Open/ClosedOpen Closed
    2014-05-09 darnir StatusConfirmed Fixed
    2014-05-02 None Attached File- Added 0001-Plug-memory-leak-2.patch, #31299
    2014-05-01 darnir Severity3 - Normal 2 - Minor
        StatusNone Confirmed
    2014-04-25 None Attached File- Added 0001-Plug-memory-leak.patch, #31246

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code