Bug 738948 - Memory leak on virDomainDefParseXML
Summary: Memory leak on virDomainDefParseXML
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.2
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Libvirt Maintainers
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-09-16 05:52 UTC by Alex Jia
Modified: 2011-09-16 14:15 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-09-16 14:15:34 UTC


Attachments (Terms of Use)

Description Alex Jia 2011-09-16 05:52:59 UTC
Description of problem:
Allocate memory to def->redirdevs in virDomainDefParseXML function such as VIR_ALLOC_N(def->redirdevs, n), however, virDomainDefFree(def) function hasn't released these memory.

Version-Release number of selected component (if applicable):
Libvirt upstream.

How reproducible:
Always.

Steps to Reproduce:
1. ./configure && make && make check all
2. valgrind -v --leak-check=full ./tests/qemuxml2xmltest
  
Actual results:

Detected in valgrind run:

==19820== 209 (16 direct, 193 indirect) bytes in 1 blocks are definitely lost in loss record 25 of 26
==19820==    at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==19820==    by 0x4A13AF: virAllocN (memory.c:129)
==19820==    by 0x4D4A0E: virDomainDefParseXML (domain_conf.c:7258)
==19820==    by 0x4D4C93: virDomainDefParseNode (domain_conf.c:7512)
==19820==    by 0x4D562F: virDomainDefParse (domain_conf.c:7465)
==19820==    by 0x415863: testCompareXMLToXMLFiles (qemuxml2xmltest.c:35)
==19820==    by 0x415982: testCompareXMLToXMLHelper (qemuxml2xmltest.c:80)
==19820==    by 0x416D31: virtTestRun (testutils.c:140)
==19820==    by 0x415604: mymain (qemuxml2xmltest.c:192)
==19820==    by 0x416437: virtTestMain (testutils.c:689)
==19820==    by 0x3CA7A1ECDC: (below main) (in /lib64/libc-2.12.so)
==19820==
==19820== LEAK SUMMARY:
==19820==    definitely lost: 16 bytes in 1 blocks
==19820==    indirectly lost: 193 bytes in 5 blocks
==19820==      possibly lost: 0 bytes in 0 blocks
==19820==    still reachable: 1,054 bytes in 21 blocks


Expected results:
Avoid memory leak.

Additional info:

Comment 1 Alex Jia 2011-09-16 05:54:59 UTC
Patch for upstream:
http://www.redhat.com/archives/libvir-list/2011-September/msg00625.html

Alex

Comment 2 Eric Blake 2011-09-16 14:15:34 UTC
This leak is not present in RHEL 6.2, since we did not backport redirdevs there.  RHEL 6.3 will rebase, and pick up the upstream patch; so I'm closing this now.


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