Bug 1069068

Summary: memory leak when lookup pool list with unsupported pool type option
Product: Red Hat Enterprise Linux 6 Reporter: Shanzhi Yu <shyu>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.6CC: acathrow, bili, chhu, dyuan, mkletzan, mzhan, pkrempa, shyu
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-04-04 21:26:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Shanzhi Yu 2014-02-24 05:34:04 UTC
Description of problem:

memory leak when look up pool list with unsupported pool type option
 
Version-Release number of selected component (if applicable):

libvirt-0.10.2-29.el6_5.4.x86_64

How reproducible:

100%

Steps to Reproduce:
1.# valgrind --leak-check=full virsh pool-list --type unsupported
==20086== Memcheck, a memory error detector
==20086== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==20086== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==20086== Command: virsh pool-list --type unsupported
==20086==
error: Invalid pool type

==20086==
==20086== HEAP SUMMARY:
==20086==     in use at exit: 138,314 bytes in 1,557 blocks
==20086==   total heap usage: 4,093 allocs, 2,536 frees, 21,364,507 bytes allocated
==20086==
==20086== 12 bytes in 1 blocks are definitely lost in loss record 11 of 84
==20086==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==20086==    by 0x393B8810C1: strdup (in /lib64/libc-2.12.so)
==20086==    by 0x40EB40: ??? (in /usr/bin/virsh)
==20086==    by 0x40FC68: ??? (in /usr/bin/virsh)
==20086==    by 0x42A9F9: ??? (in /usr/bin/virsh)
==20086==    by 0x40D240: ??? (in /usr/bin/virsh)
==20086==    by 0x410B4A: ??? (in /usr/bin/virsh)
==20086==    by 0x393B81ED1C: (below main) (in /lib64/libc-2.12.so)
==20086==
==20086== LEAK SUMMARY:
==20086==    definitely lost: 12 bytes in 1 blocks
==20086==    indirectly lost: 0 bytes in 0 blocks
==20086==      possibly lost: 0 bytes in 0 blocks
==20086==    still reachable: 138,302 bytes in 1,556 blocks
==20086==         suppressed: 0 bytes in 0 blocks
==20086== Reachable blocks (those to which a pointer was found) are not shown.
==20086== To see them, rerun with: --leak-check=full --show-reachable=yes
==20086==
==20086== For counts of detected and suppressed errors, rerun with: -v
==20086== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 8 from 6)

2.
3.

Actual results:


Expected results:

no memory leak when lookup pool list with unsupported type

Additional info:

Comment 2 Martin Kletzander 2014-02-24 08:31:01 UTC
This should be already fixed by commit v1.1.1-176-gd64af6c:

commit d64af6ce3cce0d353238086c4e1ec0fd59217cf0                 
Author: Peter Krempa <pkrempa>                       
Date:   Thu Aug 15 18:20:05 2013 +0200                          
                                                                
    virsh: modify vshStringToArray to duplicate the elements too

Comment 3 Peter Krempa 2014-02-24 08:58:11 UTC
Backtrace with debuginfo:

==2472== 5 bytes in 1 blocks are definitely lost in loss record 5 of 84
==2472==    at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==2472==    by 0x3B88281171: strdup (strdup.c:43)
==2472==    by 0x40EB40: _vshStrdup (virsh.c:129)
==2472==    by 0x40FC68: vshStringToArray (virsh.c:182)
==2472==    by 0x42A9F9: cmdPoolList (virsh-pool.c:857)
==2472==    by 0x40D240: vshCommandRun (virsh.c:1652)
==2472==    by 0x410B4A: main (virsh.c:3093)

Comment 5 RHEL Program Management 2014-04-04 21:26:35 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.