Bug 174315 - Memory leak in nanny.c
Memory leak in nanny.c
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: piranha (Show other bugs)
4.0
All Linux
medium Severity high
: ---
: ---
Assigned To: Stanko Kupcevic
Corey Marthaler
:
Depends On:
Blocks: 172895
  Show dependency treegraph
 
Reported: 2005-11-27 13:59 EST by Florin Malita
Modified: 2009-04-16 19:12 EDT (History)
2 users (show)

See Also:
Fixed In Version: RHBA-2006-0255
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-09 14:44:36 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Florin Malita 2005-11-27 13:59:39 EST
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 14:04:51 EST
Created attachment 121522 [details]
Fix for the nanny memory leak.
Comment 2 Lon Hohberger 2005-11-28 09:39:50 EST
Patch looks correct.
Comment 6 Red Hat Bugzilla 2006-03-09 14:44:37 EST
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.