RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 722806 - virsh net-info command exists memory leak
Summary: virsh net-info command exists memory leak
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Laine Stump
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-07-18 02:53 UTC by Alex Jia
Modified: 2011-12-06 11:16 UTC (History)
5 users (show)

Fixed In Version: libvirt-0.9.4-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-06 11:16:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1513 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2011-12-06 01:23:30 UTC

Description Alex Jia 2011-07-18 02:53:38 UTC
Description of problem:
Memory leak on cmdNetworkInfo function, allocate memory to 'bridge'(char *bridge = NULL), but without free it.


Version-Release number of selected component (if applicable):
# uname -r
2.6.32-160.el6.x86_64

# rpm -q libvirt
libvirt-0.9.3-5.el6.x86_64

# rpm -q qemu-kvm
qemu-kvm-0.12.1.2-2.169.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. valgrind -v --leak-check=full virsh net-info default
2. check 'LEAK SUMMARY'
  
Actual results:
--15089-- REDIR: 0x386a282440 (__GI_memset) redirected to 0x4a08e30 (memset)
Name            default
UUID            f19f2e66-9401-4e6f-b105-5a00b5490d62
Active:         yes
Persistent:     yes
Autostart:      yes
Bridge:         virbr0

==15089== 
==15089== HEAP SUMMARY:
==15089==     in use at exit: 68,480 bytes in 47 blocks
==15089==   total heap usage: 1,071 allocs, 1,024 frees, 2,887,246 bytes allocated
==15089== 
==15089== Searching for pointers to 47 not-freed blocks
==15089== Checked 1,230,840 bytes
==15089== 
==15089== 7 bytes in 1 blocks are definitely lost in loss record 1 of 15
==15089==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==15089==    by 0x386A314B3D: xdr_string (in /lib64/libc-2.12.so)
==15089==    by 0x4CFC5AD: xdr_remote_nonnull_string (remote_protocol.c:30)
==15089==    by 0x4CFD108: xdr_remote_network_get_bridge_name_ret (remote_protocol.c:1999)
==15089==    by 0x4D062D1: virNetMessageDecodePayload (virnetmessage.c:286)
==15089==    by 0x4D03735: virNetClientProgramCall (virnetclientprogram.c:318)
==15089==    by 0x4CE7752: call (remote_driver.c:3927)
==15089==    by 0x4CEDDD2: remoteNetworkGetBridgeName (remote_client_bodies.h:3384)
==15089==    by 0x4CC4E3E: virNetworkGetBridgeName (libvirt.c:8503)
==15089==    by 0x40F614: cmdNetworkInfo (virsh.c:5019)
==15089==    by 0x410CC2: vshCommandRun (virsh.c:12758)
==15089==    by 0x41F286: main (virsh.c:14110)
==15089== 
==15089== LEAK SUMMARY:
==15089==    definitely lost: 7 bytes in 1 blocks



Expected results:
Avoid memory leak.

Additional info:
Has fix this issue:
https://www.redhat.com/archives/libvir-list/2011-July/msg00917.html
https://www.redhat.com/archives/libvir-list/2011-July/msg00921.html

Comment 2 Osier Yang 2011-08-02 08:52:02 UTC
commit 22da8c941cc806a40cee69955ecb105f9b8e5a40
Author: Alex Jia <ajia>
Date:   Tue Aug 2 16:31:36 2011 +0800

    virsh: fix memory leak in cmdNetworkInfo
    
    * tools/virsh.c: avoid memory leak in cmdNetworkInfo.
    
    * how to reproduce?
      % valgrind -v --leak-check=yes virsh net-info default
    
      https://bugzilla.redhat.com/show_bug.cgi?id=722806

Move to POST.

Comment 5 dyuan 2011-08-04 06:54:02 UTC
Reproduced this bug with libvirt-0.9.4-0rc2.el6.

Verified PASS with libvirt-0.9.4-1.el6
pkgs:
qemu-kvm-0.12.1.2-2.176.el6
kernel-2.6.32-176.el6

==12064== 
==12064== HEAP SUMMARY:
==12064==     in use at exit: 331,377 bytes in 53 blocks
==12064==   total heap usage: 1,113 allocs, 1,060 frees, 2,892,195 bytes allocated
==12064== 
==12064== Searching for pointers to 53 not-freed blocks
==12064== Checked 1,519,304 bytes
==12064== 
==12064== LEAK SUMMARY:
==12064==    definitely lost: 0 bytes in 0 blocks
==12064==    indirectly lost: 0 bytes in 0 blocks
==12064==      possibly lost: 0 bytes in 0 blocks
==12064==    still reachable: 331,377 bytes in 53 blocks
==12064==         suppressed: 0 bytes in 0 blocks
==12064== Reachable blocks (those to which a pointer was found) are not shown.
==12064== To see them, rerun with: --leak-check=full --show-reachable=yes
==12064== 
==12064== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 8 from 6)
--12064-- 
--12064-- used_suppression:      8 dl-hack3-cond-1
==12064== 
==12064== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 8 from 6)

Comment 6 errata-xmlrpc 2011-12-06 11:16:51 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1513.html


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