[Libvir] virsh capabilities cmd: plug a leak

Here's another: $ valgrind --leak-check=full \ ./virsh --connect test://$PWD/../docs/testnode.xml capabilities ... ==16392== 368 bytes in 1 blocks are definitely lost in loss record 13 of 27 ==16392== at 0x4A059F6: malloc (vg_replace_malloc.c:149) ==16392== by 0x387BC7CC11: strdup (strdup.c:43) ==16392== by 0x4194D2: testGetCapabilities (test.c:1006) ==16392== by 0x412B43: virConnectGetCapabilities (libvirt.c:2119) ==16392== by 0x408047: cmdCapabilities (virsh.c:2018) ==16392== by 0x40C5F9: vshCommandRun (virsh.c:4032) ==16392== by 0x40E6AF: main (virsh.c:4991) ==16392== Here's the patch: * src/virsh.c (cmdCapabilities): Plug a small leak. diff --git a/src/virsh.c b/src/virsh.c index c09dc8d..0d93fb6 100644 --- a/src/virsh.c +++ b/src/virsh.c @@ -2020,6 +2020,7 @@ cmdCapabilities (vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED) return FALSE; } vshPrint (ctl, "%s\n", caps); + free (caps); return TRUE; } -- 1.5.4.rc5.1.g0fa73

On Wed, Jan 30, 2008 at 04:39:37PM +0100, Jim Meyering wrote:
Here's another:
$ valgrind --leak-check=full \ ./virsh --connect test://$PWD/../docs/testnode.xml capabilities ... ==16392== 368 bytes in 1 blocks are definitely lost in loss record 13 of 27 ==16392== at 0x4A059F6: malloc (vg_replace_malloc.c:149) ==16392== by 0x387BC7CC11: strdup (strdup.c:43) ==16392== by 0x4194D2: testGetCapabilities (test.c:1006) ==16392== by 0x412B43: virConnectGetCapabilities (libvirt.c:2119) ==16392== by 0x408047: cmdCapabilities (virsh.c:2018) ==16392== by 0x40C5F9: vshCommandRun (virsh.c:4032) ==16392== by 0x40E6AF: main (virsh.c:4991) ==16392==
Here's the patch:
* src/virsh.c (cmdCapabilities): Plug a small leak.
ACk Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

ACK this & all the other patches from yesterday. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
participants (3)
-
Daniel P. Berrange
-
Jim Meyering
-
Richard W.M. Jones