From b1f6792cb6debec0871e2d8067b2578c3e2028d9 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Thu, 9 Jun 2016 09:05:35 +0200 Subject: [PATCH] virsh-domain: fix memory leak in cmdDomDisplay Signed-off-by: Pavel Hrdina --- tools/virsh-domain.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 6f8edbb5d1..11116a90ad 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -10637,8 +10637,10 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) * fails, if there is no listen_addr we will print "localhost". */ VIR_FREE(listen_addr); - if (uri && VIR_STRDUP(listen_addr, uri->server) < 0) - goto cleanup; + if (uri) { + listen_addr = vshStrdup(ctl, uri->server); + virURIFree(uri); + } } }