[Nagiosplug-devel] [ nagiosplug-Patches-2957455 ] check_http leaks memory for pages larger than buffer

SourceForge.net noreply at sourceforge.net
Fri Feb 26 17:22:05 CET 2010


Patches item #2957455, was opened at 2010-02-23 21:22
Message generated for change (Comment added) made by tonvoon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=2957455&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Bugfix
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Jimmy Bergman (jimmybergman)
>Assigned to: Ton Voon (tonvoon)
Summary: check_http leaks memory for pages larger than buffer

Initial Comment:
Since asprintf allocates a new buffer and is used in the main check_http receive loop like:
asprintf (&full_page, "%s%s", full_page, buffer);

full_page is overwritten every iteration of the loop, thereby leaking lots of memory.

This makes check_http use 460 MB resident memory when downloading a 16 MB file completely reproduceable.

The attached patch fixes this bug by making asprintf store the reference to the new string in a separate pointer and freeing the old one on each iteration instead, thus only keeping one version of the page in memory.

----------------------------------------------------------------------

>Comment By: Ton Voon (tonvoon)
Date: 2010-02-26 16:22

Message:
Jimmy,

Thanks for the patch. All tests passed in tests/check_http.t with the
change.

Have applied to git, so should be in the next snapshot.

Ton


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=2957455&group_id=29880




More information about the Devel mailing list