From f50ba8e49fbc93a90b51a60431d14b234b71a027 Mon Sep 17 00:00:00 2001 From: Julio Faracco Date: Fri, 7 Jul 2017 18:35:33 -0300 Subject: [PATCH] tools: virsh: domdisplay command is not freeing the domain pointer 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 --- tools/virsh-domain.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 55f4e14a46..8f3d4d50e7 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; }