qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] vhost: fix a memory leak


From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH] vhost: fix a memory leak
Date: Tue, 4 Jul 2017 23:59:54 +0200

Hi

On Wed, Jul 5, 2017 at 12:33 AM, Peng Hao <address@hidden> wrote:
> vhost exists a call for g_file_get_contents, but not call g_free.
>
> Signed-off-by: Peng Hao<address@hidden>

Reviewed-by: Marc-André Lureau <address@hidden>

mst: is this better?

> ---
>  hw/virtio/vhost-backend.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c
> index 4e31de1..2c481d6 100644
> --- a/hw/virtio/vhost-backend.c
> +++ b/hw/virtio/vhost-backend.c
> @@ -52,11 +52,13 @@ static int vhost_kernel_memslots_limit(struct vhost_dev 
> *dev)
>                              &s, NULL, NULL)) {
>          uint64_t val = g_ascii_strtoull(s, NULL, 10);
>          if (!((val == G_MAXUINT64 || !val) && errno)) {
> +            g_free(s);
>              return val;
>          }
>          error_report("ignoring invalid max_mem_regions value in vhost 
> module:"
>                       " %s", s);
>      }
> +    g_free(s);
>      return limit;
>  }
>
> --
> 1.8.3.1
>
>
>



-- 
Marc-André Lureau



reply via email to

[Prev in Thread] Current Thread [Next in Thread]