On Wed, May 11, 2016 at 08:13:11PM +0200, Marc-André Lureau wrote:
Hi
On Wed, May 11, 2016 at 5:08 PM, Pavel Hrdina <phrdina(a)redhat.com> wrote:
> We support omitting listen attribute of graphics element so we should
> also support omitting address attribute of listen element. This patch
> also updates libvirt to always add a listen element into domain XML
> except for VNC graphics if socket attribute is specified.
>
> Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
> ---
[...]
> diff --git a/src/xenconfig/xen_common.c
b/src/xenconfig/xen_common.c
> index c6aee69..629fbf5 100644
> --- a/src/xenconfig/xen_common.c
> +++ b/src/xenconfig/xen_common.c
> @@ -594,8 +594,7 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
>
> if (xenConfigCopyStringOpt(conf, "vnclisten",
&listenAddr) < 0)
> goto cleanup;
> - if (listenAddr &&
> - virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0)
> + if (virDomainGraphicsListenAppendAddress(graphics, listenAddr) < 0)
> goto cleanup;
> VIR_FREE(listenAddr);
>
> @@ -664,8 +663,7 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
> if (STREQ(key + 10, "1"))
> graphics->data.vnc.autoport = true;
> } else if (STRPREFIX(key, "vnclisten=")) {
> - if (virDomainGraphicsListenAppendAddress(graphics,
> - key+10) < 0)
> + if (VIR_STRDUP(listenAddr, key+10) < 0)
> goto cleanup;
> } else if (STRPREFIX(key, "vncpasswd=")) {
> if (VIR_STRDUP(graphics->data.vnc.auth.passwd, key + 10)
< 0)
> @@ -699,6 +697,11 @@ xenParseVfb(virConfPtr conf, virDomainDefPtr def)
> nextkey++;
> key = nextkey;
> }
> + if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
> + if (virDomainGraphicsListenAppendAddress(graphics,
> + listenAddr) < 0)
> + goto cleanup;
I think it's missing a VIR_FREE(listenAddr) here.
Nice catch, I'll fix it.
Thanks, Pavel