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

SourceForge.net noreply at sourceforge.net
Tue Feb 23 22:22:30 CET 2010


Patches item #2957455, was opened at 2010-02-23 22:22
Message generated for change (Tracker Item Submitted) made by jimmybergman
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: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jimmy Bergman (jimmybergman)
Assigned to: Nobody/Anonymous (nobody)
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.

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

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