Bug 169051

Summary: Memory leak when using innetgr function
Product: Red Hat Enterprise Linux 4 Reporter: CAPELLE Benoit <capelle>
Component: glibcAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: high Docs Contact:
Priority: medium    
Version: 4.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2006-0124 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-07 18:22:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 168429    
Attachments:
Description Flags
innetgr Patch
none
Sample /etc/netgroup file none

Description CAPELLE Benoit 2005-09-22 15:54:40 UTC
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 15:56:56 UTC
Created attachment 119145 [details]
innetgr Patch

Comment 2 CAPELLE Benoit 2005-09-22 15:57:57 UTC
Created attachment 119146 [details]
Sample /etc/netgroup file

Comment 9 Red Hat Bugzilla 2006-03-07 18:22:50 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-0124.html