Bug 769225

Summary: memory leak when run 'virsh domxml-from-native'
Product: Red Hat Enterprise Linux 6 Reporter: Alex Jia <ajia>
Component: libvirtAssignee: Alex Jia <ajia>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: high    
Version: 6.3CC: acathrow, dallan, dyuan, eblake, mzhan, rwu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-20 21:47:36 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:

Description Alex Jia 2011-12-20 10:35:28 UTC
Description of problem:
A quite big leak on cmdDomXMLFromNative 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-from-native qemu-argv foo.xml
3. check 'LEAK SUMMARY' section
  
Actual results:

==9724== 8,193 bytes in 1 blocks are definitely lost in loss record 31 of 33
==9724==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
==9724==    by 0x4A06167: realloc (vg_replace_malloc.c:525)
==9724==    by 0x4C7510B: virReallocN (memory.c:161)
==9724==    by 0x4C84679: virFileReadLimFD (util.c:394)
==9724==    by 0x4C84815: virFileReadAll (util.c:455)
==9724==    by 0x41A89F: cmdDomXMLFromNative (virsh.c:5532)
==9724==    by 0x414872: vshCommandRun (virsh.c:16464)
==9724==    by 0x425623: main (virsh.c:17971)
==9724==
==9724== LEAK SUMMARY:
==9724==    definitely lost: 8,193 bytes in 1 blocks
==9724==    indirectly lost: 0 bytes in 0 blocks
==9724==      possibly lost: 0 bytes in 0 blocks
==9724==    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:26 UTC
Patch for upstream:
http://www.redhat.com/archives/libvir-list/2011-December/msg00875.html

Comment 2 Eric Blake 2011-12-20 21:47:36 UTC
Since a single patch fixed both domxml-from-native and domxml-to-native, I'm closing this as a dup.

*** This bug has been marked as a duplicate of bug 769224 ***