Bug 174315 - Memory leak in nanny.c
Summary: Memory leak in nanny.c
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: piranha
Version: 4.0
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
: ---
Assignee: Stanko Kupcevic
QA Contact: Corey Marthaler
URL:
Whiteboard:
Depends On:
Blocks: 172895
TreeView+ depends on / blocked
 
Reported: 2005-11-27 18:59 UTC by Florin Malita
Modified: 2009-04-16 23:12 UTC (History)
2 users (show)

Fixed In Version: RHBA-2006-0255
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-03-09 19:44:36 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Fix for the nanny memory leak. (1.19 KB, patch)
2005-11-27 19:04 UTC, Florin Malita
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2006:0255 0 normal SHIPPED_LIVE piranha bug fix update 2006-03-09 05:00:00 UTC

Description Florin Malita 2005-11-27 18:59:39 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050524 Fedora/1.0.4-4 Firefox/1.0.4

Description of problem:
When using an external send program (-e), nanny fails to deallocate the result buffer and leaks memory upon every external invocation.



Version-Release number of selected component (if applicable):
piranha-0.7.0 through piranha-0.8.1

How reproducible:
Always

Steps to Reproduce:
1. start a nanny instance with a verbose external check program executed often (1s):

nanny -c -h 192.168.0.0 -p 1234 -e /sbin/lspci -x BLAH -q -t 1 --lvs&

2. watch the process memory footprint

watch -n1 "cat /proc/$(PID)/status"
  

Actual Results:  The memory footprint continues to grow indefinitely.

Expected Results:  The memory footprint should stabilize.

Additional info:

The actual leak is in nanny.c::external_check() which fails to deallocate the "result" buffer allocated by getExecOutput() using strdup:

        result = getExecOutput (flags, argv, timeout);

        if (expect_str != NULL) {
                if (strcmp (expect_str, result) != 0) {
                        piranha_log (flags, (char *)
                                     "Trouble. Recieved results are not what we 
expected from (%s)\n",
                                     inet_ntoa (*remoteAddr));
                        return 1;
                } else {
                        return 0;
                }

        }

A patch will be available shortly.

Comment 1 Florin Malita 2005-11-27 19:04:51 UTC
Created attachment 121522 [details]
Fix for the nanny memory leak.

Comment 2 Lon Hohberger 2005-11-28 14:39:50 UTC
Patch looks correct.

Comment 6 Red Hat Bugzilla 2006-03-09 19:44:37 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0255.html



Note You need to log in before you can comment on or make changes to this bug.