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 769224 - memory leak when run 'virsh domxml-to-native'
Summary: memory leak when run 'virsh domxml-to-native'
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.3
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Alex Jia
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 769225 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-20 10:35 UTC by Alex Jia
Modified: 2012-06-20 06:39 UTC (History)
8 users (show)

Fixed In Version: libvirt-0.9.9-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-06-20 06:39:27 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0748 0 normal SHIPPED_LIVE Low: libvirt security, bug fix, and enhancement update 2012-06-19 19:31:38 UTC

Description Alex Jia 2011-12-20 10:35:25 UTC
Description of problem:
A quite big leak on cmdDomXMLToNative function.

Version-Release number of selected component (if applicable):
# rpm -qf /usr/bin/virsh
libvirt-client-0.9.8-1.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1. virsh dumpxml ${guest} > foo.xml
2. valgrind -v --leak-check=full virsh domxml-to-native qemu-argv foo.xml
3. check 'LEAK SUMMARY' section
  
Actual results:

==7409== 8,193 bytes in 1 blocks are definitely lost in loss record 31 of 33
==7409==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==7409==    by 0x4A06167: realloc (vg_replace_malloc.c:525)
==7409==    by 0x4C7510B: virReallocN (memory.c:161)
==7409==    by 0x4C84679: virFileReadLimFD (util.c:394)
==7409==    by 0x4C84815: virFileReadAll (util.c:455)
==7409==    by 0x41A7AF: cmdDomXMLToNative (virsh.c:5578)
==7409==    by 0x414892: vshCommandRun (virsh.c:16463)
==7409==    by 0x425633: main (virsh.c:17970)
==7409==
==7409== LEAK SUMMARY:
==7409==    definitely lost: 8,193 bytes in 1 blocks
==7409==    indirectly lost: 0 bytes in 0 blocks
==7409==      possibly lost: 0 bytes in 0 blocks
==7409==    still reachable: 127,128 bytes in 1,347 blocks

Expected results:
avoid memory leak.

Additional info:

Comment 1 Alex Jia 2011-12-20 10:36:21 UTC
Patch for upstream:
http://www.redhat.com/archives/libvir-list/2011-December/msg00875.html

Comment 2 Eric Blake 2011-12-20 21:46:53 UTC
commit ea964658af7a54216e3c7c3ee2e0d2ea719ba018
Author: Alex Jia <ajia>
Date:   Tue Dec 20 18:33:52 2011 +0800

    virsh: plug mem leaks in domxml-*-native
    
    Detected by valgrind. Leaks introduced in commit 4d5383f.
    
    * tools/virsh.c: fix memory leaks on cmdDomXMLFromNative and cmdDomXMLToNative. 
    * how to reproduce?
    
      % virsh dumpxml ${guest} > foo.xml
      % valgrind -v --leak-check=full virsh domxml-from-native qemu-argv foo.xml
      % valgrind -v --leak-check=full virsh domxml-to-native qemu-argv foo.xml

Comment 3 Eric Blake 2011-12-20 21:47:36 UTC
*** Bug 769225 has been marked as a duplicate of this bug. ***

Comment 4 Eric Blake 2011-12-20 21:48:19 UTC
(In reply to comment #3)
> *** Bug 769225 has been marked as a duplicate of this bug. ***

Be sure to also test domxml-from-native when verifying this bug, since it was a single patch for both leaks.

Comment 6 xhu 2012-01-10 08:32:03 UTC
Reproduce it with libvirt-0.9.8-1.el6.x86_64.
Verify it with libvirt-0.9.9-1.el6 and it passed.

Comment 8 errata-xmlrpc 2012-06-20 06:39:27 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/RHSA-2012-0748.html


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