[libvirt] [PATCH] tools: domdisplay command is not freeing the domain pointer.

Julio Faracco posted 1 patch 115 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/1499463333-29525-1-git-send-email-jcfaracco@gmail.com
tools/virsh-domain.c | 1 +
1 file changed, 1 insertion(+)

[libvirt] [PATCH] tools: domdisplay command is not freeing the domain pointer.

Posted by Julio Faracco 115 weeks ago
The command 'domdisplay' is not freeing the domain pointer properly in 
cleanup section. See the error below:

virsh # domdisplay WINDOWS7
vnc://127.0.0.1:0

virsh # quit

error: One or more references were leaked after disconnect from the hypervisor

Valgrind report:

==29168== 66 (56 direct, 10 indirect) bytes in 1 blocks are definitely lost in loss record 154 of 239
==29168==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==29168==    by 0x5505324: virAllocVar (viralloc.c:560)
==29168==    by 0x555A61B: virObjectNew (virobject.c:199)
==29168==    by 0x561F367: virGetDomain (datatypes.c:284)
==29168==    by 0x5680979: get_nonnull_domain (remote_driver.c:8143)
==29168==    by 0x5680979: remoteDomainLookupByName (remote_client_bodies.h:3047)
==29168==    by 0x5623D9A: virDomainLookupByName (libvirt-domain.c:425)
==29168==    by 0x160480: virshLookupDomainInternal (virsh-util.c:59)
==29168==    by 0x160547: virshCommandOptDomainBy (virsh-util.c:98)
==29168==    by 0x13D3A9: cmdDomDisplay (virsh-domain.c:10963)
==29168==    by 0x165680: vshCommandRun (vsh.c:1327)
==29168==    by 0x12E320: main (virsh.c:953)

Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
---
 tools/virsh-domain.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 55f4e14..8f3d4d5 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -11153,6 +11153,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
     VIR_FREE(output);
     xmlXPathFreeContext(ctxt);
     xmlFreeDoc(xml);
+    virshDomainFree(dom);
     return ret;
 }
 
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] tools: domdisplay command is not freeing the domain pointer.

Posted by Peter Krempa 114 weeks ago
On Fri, Jul 07, 2017 at 18:35:33 -0300, Julio Faracco wrote:

I'll tweak the subject (summary) line a bit ...

> The command 'domdisplay' is not freeing the domain pointer properly in 
> cleanup section. See the error below:

[...]

> Signed-off-by: Julio Faracco <jcfaracco@gmail.com>
> ---
>  tools/virsh-domain.c | 1 +
>  1 file changed, 1 insertion(+)

ACK, and I'll push it in a while
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list