[Spice-devel] [PATCH spice-server 4/6] spicevmc: Remove leak of RedPortInitPipeItem::name

Uri Lublin uril at redhat.com
Thu Jan 26 13:47:00 UTC 2017


On 01/26/2017 12:56 PM, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

Ack.

Uri.

> ---
>  server/spicevmc.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/server/spicevmc.c b/server/spicevmc.c
> index 23e60b3..f441822 100644
> --- a/server/spicevmc.c
> +++ b/server/spicevmc.c
> @@ -376,13 +376,21 @@ static void spicevmc_chardev_send_msg_to_client(RedCharDevice *self,
>      red_channel_client_pipe_add_push(channel->rcc, msg);
>  }
>
> +static void red_port_init_item_free(struct RedPipeItem *base)
> +{
> +    RedPortInitPipeItem *item = SPICE_UPCAST(RedPortInitPipeItem, base);
> +
> +    free(item->name);
> +    free(item);
> +}
> +
>  static void spicevmc_port_send_init(RedChannelClient *rcc)
>  {
>      RedVmcChannel *channel = RED_VMC_CHANNEL(red_channel_client_get_channel(rcc));
>      SpiceCharDeviceInstance *sin = channel->chardev_sin;
>      RedPortInitPipeItem *item = spice_new(RedPortInitPipeItem, 1);
>
> -    red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_PORT_INIT);
> +    red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_PORT_INIT, red_port_init_item_free);
>      item->name = strdup(sin->portname);
>      item->opened = channel->port_opened;
>      red_channel_client_pipe_add_push(rcc, &item->base);
>



More information about the Spice-devel mailing list