Bug 540521

Summary: netcf_close is not free'ing the netlink handle
Product: [Fedora] Fedora Reporter: Daniel BerrangĂ© <berrange>
Component: netcfAssignee: David Lutterkort <lutter>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: hbrock, lutter
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 0.1.5-1.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-12-18 04:33:22 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: 540330    
Attachments:
Description Flags
Fix free'ing of netlink handle none

Description Daniel Berrangé 2009-11-23 15:13:51 UTC
Description of problem:
valgrind is showing a memory leak from  the netlink_init() callpath. Looking at the corresponding netlink-close() method in netcf, it appears it is merely closing the socket, and not free'ing the memory for the libnl handle.

Version-Release number of selected component (if applicable):
0.1.4

How reproducible:
Always

Steps to Reproduce:
1. Run this test program under valgrind

#include <netcf.h>
#include <stdio.h>

int main(int argc, char **argv)
{
    for (int i = 0 ; i < 1000000 ; i++) {
        struct netcf *netcf = NULL;

        ncf_init(&netcf, NULL);

        if (netcf != NULL) {
            ncf_close(netcf);
        }
    }
    return 0;
}


2. Compile and run that as root
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Daniel Berrangé 2009-11-23 15:14:44 UTC
Created attachment 373139 [details]
Fix free'ing of netlink handle

Comment 2 David Lutterkort 2009-11-23 19:00:01 UTC
Cool - saves me from firing up valgrind. Patch committed upstream.

Comment 3 Fedora Update System 2009-12-02 04:26:33 UTC
netcf-0.1.5-1.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update netcf'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F12/FEDORA-2009-12472

Comment 4 Fedora Update System 2009-12-18 04:33:12 UTC
netcf-0.1.5-1.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.