]> xenbits.xensource.com Git - libvirt.git/commitdiff
tools: virsh: domdisplay command is not freeing the domain pointer
authorJulio Faracco <jcfaracco@gmail.com>
Fri, 7 Jul 2017 21:35:33 +0000 (18:35 -0300)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 10 Jul 2017 07:28:34 +0000 (09:28 +0200)
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

index 55f4e14a46ae00dd2fce26287c5c1bc185513562..8f3d4d50e77a2595963711a3e8004fefeb45b111 100644 (file)
@@ -11153,6 +11153,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd)
     VIR_FREE(output);
     xmlXPathFreeContext(ctxt);
     xmlFreeDoc(xml);
+    virshDomainFree(dom);
     return ret;
 }