Bug 169051 - Memory leak when using innetgr function
Memory leak when using innetgr function
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: glibc (Show other bugs)
4.0
i386 Linux
medium Severity high
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
:
Depends On:
Blocks: 168429
  Show dependency treegraph
 
Reported: 2005-09-22 11:54 EDT by CAPELLE Benoit
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version: RHBA-2006-0124
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-07 13:22:50 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)
innetgr Patch (828 bytes, patch)
2005-09-22 11:56 EDT, CAPELLE Benoit
no flags Details | Diff
Sample /etc/netgroup file (907 bytes, text/plain)
2005-09-22 11:57 EDT, CAPELLE Benoit
no flags Details

  None (edit)
Description CAPELLE Benoit 2005-09-22 11:54:40 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.4) KHTML/3.4.2 (like Gecko)

Description of problem:
Function innetgr() doesn't free memory if the specified machine is found  
in the file /etc/netgroup. Doesn't happen in case of no match. This function  
is used by rpc.mountd (nfs-utils) to check if an host is a member of a network  
group. Attached patch fixes the bug. 
 

Version-Release number of selected component (if applicable):
glibc-2.3.4-2.9

How reproducible:
Always

Steps to Reproduce:
1. Compile following sample program:     
#include <stdio.h> 
#include <stdlib.h> 
#include <sys/types.h> 
#include <unistd.h> 
#include <string.h>  
#include <netdb.h> 
 
int main(int argc, char *argv[]) { 
        char    *hname = "p1.mygroup.com"; 
        char    *cname = "@mygroup"; 
 
        while(1) { 
                if(innetgr(cname+1, hname, NULL, NULL)) { 
                        printf("Found\n"); 
                } 
                sleep(1); 
        } 
} 
2. Edit /etc/nsswitch.conf, on line networks, put: 
networks:   files 
3. Save provided attachment as /etc/netgroup   

Actual Results:  Sample program indefinitly calls innetgr() to check if host  
p1.mygroup.com is a member of network group mygroup and 
sleeps 1 second. 
 
Using top command shows that memory is consumed on every iteration. 

Expected Results:  Memory usage should not increase. 

Additional info:

Bug tested on Fedora 4 with glibc-2.3.5-10.3
Comment 1 CAPELLE Benoit 2005-09-22 11:56:56 EDT
Created attachment 119145 [details]
innetgr Patch
Comment 2 CAPELLE Benoit 2005-09-22 11:57:57 EDT
Created attachment 119146 [details]
Sample /etc/netgroup file
Comment 9 Red Hat Bugzilla 2006-03-07 13:22:50 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-0124.html

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