Re: [gconfig v2 3/6] Introduce libvirt-gconfig-domain-graphics-listen-address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 17, 2016 at 06:58:48PM +0300, Visarion Alexandru wrote:
> From: Visarion Alexandru <viorel.visarion@xxxxxxxxx>
> 
> This is needed to be able to change the address a graphics
> device is listening for.
> ---
>  libvirt-gconfig/Makefile.am                        |   2 +
>  ...ibvirt-gconfig-domain-graphics-listen-address.c | 128 +++++++++++++++++++++
>  ...ibvirt-gconfig-domain-graphics-listen-address.h |  78 +++++++++++++
>  libvirt-gconfig/libvirt-gconfig.h                  |   1 +
>  libvirt-gconfig/libvirt-gconfig.sym                |   7 ++
>  5 files changed, 216 insertions(+)
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
>  create mode 100644 libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.h
> 
> diff --git a/libvirt-gconfig/Makefile.am b/libvirt-gconfig/Makefile.am
> index 09739c5..5e66c4a 100644
> --- a/libvirt-gconfig/Makefile.am
> +++ b/libvirt-gconfig/Makefile.am
> @@ -47,6 +47,7 @@ GCONFIG_HEADER_FILES = \
>  			libvirt-gconfig-domain-graphics.h \
>  			libvirt-gconfig-domain-graphics-desktop.h \
>  			libvirt-gconfig-domain-graphics-listen.h\
> +			libvirt-gconfig-domain-graphics-listen-address.h\
>  			libvirt-gconfig-domain-graphics-rdp.h \
>  			libvirt-gconfig-domain-graphics-sdl.h \
>  			libvirt-gconfig-domain-graphics-spice.h \
> @@ -141,6 +142,7 @@ GCONFIG_SOURCE_FILES = \
>  			libvirt-gconfig-domain-graphics.c \
>  			libvirt-gconfig-domain-graphics-desktop.c \
>  			libvirt-gconfig-domain-graphics-listen.c\
> +			libvirt-gconfig-domain-graphics-listen-address.c\
>  			libvirt-gconfig-domain-graphics-rdp.c \
>  			libvirt-gconfig-domain-graphics-sdl.c \
>  			libvirt-gconfig-domain-graphics-spice.c \
> diff --git a/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
> new file mode 100644
> index 0000000..74815a8
> --- /dev/null
> +++ b/libvirt-gconfig/libvirt-gconfig-domain-graphics-listen-address.c
> +
> +void gvir_config_domain_graphics_listen_address_set_address(GVirConfigDomainGraphicsListenAddress *listen,
> +                                                            const gchar *address)
> +{
> +    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_ADDRESS(listen));
> +
> +    gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(listen),
> +                                     "address", address,
> +                                     NULL);
> +}
> +
> +const gchar *
> +gvir_config_domain_graphics_listen_address_get_address(GVirConfigDomainGraphicsListenAddress *listen)
> +{
> +    g_return_val_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_ADDRESS(listen), NULL);
> +
> +    return gvir_config_object_get_attribute(GVIR_CONFIG_OBJECT(listen),
> +                                            NULL,
> +                                            "address");
> +}
> +
> +void gvir_config_domain_graphics_listen_address_set_inet_address(GVirConfigDomainGraphicsListenAddress *listen,
> +                                                                 GInetAddress *address)
> +{
> +    g_return_if_fail(GVIR_CONFIG_IS_DOMAIN_GRAPHICS_LISTEN_ADDRESS(listen));
> +
> +    gvir_config_object_set_attribute(GVIR_CONFIG_OBJECT(listen),
> +                                     "address", g_inet_address_to_string (address),
> +                                     NULL);

You need to g_free() the string returned by
g_inet_address_new_from_string() after using it or you will have a
memory leak. Fixed locally too, so no need to resend.

Acked-by: Christophe Fergeau <cfergeau@xxxxxxxxxx>

Christophe

Attachment: signature.asc
Description: PGP signature

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]