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


bug #42195: Content encoding string leaked

Submitted by:  None
Submitted on:  Fri Apr 25 11:27:25 2014  
Category: Memory LeakSeverity: 2 - Minor
Priority: 5 - NormalStatus: Fixed
Privacy: PublicAssigned to: None
Originator Name: Benjamin GooseOriginator Email: -unavailable-
Open/Closed: ClosedRelease: trunk
Operating System: GNU/LinuxReproducibility: Every Time
Fixed Release: NonePlanned Release: None
Regression: NoneWork Required: None
Patch Included: Yes

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


Fri May 2 18:47:29 2014, comment #2:

Thanks for the reply. A new patch is attached.

(file #31299)

Thu May 1 07:58:17 2014, comment #1:


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>
Project Administrator
Fri Apr 25 11:27:25 2014, 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.


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

Attach File(s):

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
  • -unavailable- added by darnir (Posted a comment)
  • -unavailable- added by None (Submitted the item)

    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun Jun 8 14:32:39 2014darnirOpen/ClosedOpen=>Closed
    Fri May 9 22:56:49 2014darnirStatusConfirmed=>Fixed
    Fri May 2 18:47:29 2014NoneAttached File-=>Added 0001-Plug-memory-leak-2.patch, #31299
    Thu May 1 07:58:17 2014darnirSeverity3 - Normal=>2 - Minor
    Fri Apr 25 11:27:26 2014NoneAttached File-=>Added 0001-Plug-memory-leak.patch, #31246

    Back to the top

    Powered by Savane 3.1-cleanup1