diff options
author | Alex Jia <ajia@redhat.com> | 2012-02-10 13:26:29 +0800 |
---|---|---|
committer | Alex Jia <ajia@redhat.com> | 2012-02-10 14:52:21 +0800 |
commit | 6d514728cc88a0df4c2d334c771fdd9122f46b15 (patch) | |
tree | 078a3a19ebf234b2d41f885efba0c1e87970d5fc | |
parent | npiv: Auto-generate WWN if it's not specified (diff) | |
download | libvirt-6d514728cc88a0df4c2d334c771fdd9122f46b15.tar.gz libvirt-6d514728cc88a0df4c2d334c771fdd9122f46b15.tar.bz2 libvirt-6d514728cc88a0df4c2d334c771fdd9122f46b15.zip |
rpc: Plug memory leaks on doRemoteOpen() failure path
Detected by valgrind. Leaks are introduced in commit c1b2264.
* src/remote/remote_driver.c (doRemoteOpen): free client program memory in failure path.
* How to reproduce?
% valgrind -v --leak-check=full virsh -c qemu:
* Actual result
==3969== 40 bytes in 1 blocks are definitely lost in loss record 8 of 28
==3969== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==3969== by 0x4C89C41: virAlloc (memory.c:101)
==3969== by 0x4D5A236: virNetClientProgramNew (virnetclientprogram.c:60)
==3969== by 0x4D47AB4: doRemoteOpen (remote_driver.c:658)
==3969== by 0x4D49FFF: remoteOpen (remote_driver.c:871)
==3969== by 0x4D13373: do_open (libvirt.c:1196)
==3969== by 0x4D14535: virConnectOpenAuth (libvirt.c:1422)
==3969== by 0x425627: main (virsh.c:18537)
==3969==
==3969== 40 bytes in 1 blocks are definitely lost in loss record 9 of 28
==3969== at 0x4A04A28: calloc (vg_replace_malloc.c:467)
==3969== by 0x4C89C41: virAlloc (memory.c:101)
==3969== by 0x4D5A236: virNetClientProgramNew (virnetclientprogram.c:60)
==3969== by 0x4D47AD7: doRemoteOpen (remote_driver.c:664)
==3969== by 0x4D49FFF: remoteOpen (remote_driver.c:871)
==3969== by 0x4D13373: do_open (libvirt.c:1196)
==3969== by 0x4D14535: virConnectOpenAuth (libvirt.c:1422)
==3969== by 0x425627: main (virsh.c:18537)
==3969==
==3969== LEAK SUMMARY:
==3969== definitely lost: 80 bytes in 2 blocks
Signed-off-by: Alex Jia <ajia@redhat.com>
-rw-r--r-- | src/remote/remote_driver.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index e06812641..2dacb70f6 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -753,6 +753,8 @@ doRemoteOpen (virConnectPtr conn, free_qparam_set (vars); failed: + virNetClientProgramFree(priv->remoteProgram); + virNetClientProgramFree(priv->qemuProgram); virNetClientClose(priv->client); virNetClientFree(priv->client); priv->client = NULL; |