All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Qemu-devel] [PATCH] vhost: fix a memory leak
  2017-07-04 22:33 [Qemu-devel] [PATCH] vhost: fix a memory leak Peng Hao
@ 2017-07-04 14:21 ` Marc-André Lureau
  2017-07-04 21:32   ` Michael S. Tsirkin
  2017-07-04 21:59 ` Marc-André Lureau
  1 sibling, 1 reply; 5+ messages in thread
From: Marc-André Lureau @ 2017-07-04 14:21 UTC (permalink / raw)
  To: Peng Hao, mst; +Cc: qemu-devel, Igor Mammedov

Hi

On Tue, Jul 4, 2017 at 4:16 PM Peng Hao <peng.hao2@zte.com.cn> wrote:

> vhost exists a call for g_file_get_contents, but not call g_free.
>
> Signed-off-by: Peng Hao<peng.hao2@zte.com.cn>
>

 Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost: fix a memory leak
  2017-07-04 14:21 ` Marc-André Lureau
@ 2017-07-04 21:32   ` Michael S. Tsirkin
  0 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2017-07-04 21:32 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: Peng Hao, qemu-devel, Igor Mammedov, Eric Blake

On Tue, Jul 04, 2017 at 02:21:08PM +0000, Marc-André Lureau wrote:
> Hi
> 
> On Tue, Jul 4, 2017 at 4:16 PM Peng Hao <peng.hao2@zte.com.cn> wrote:
> 
>     vhost exists a call for g_file_get_contents, but not call g_free.
> 
>     Signed-off-by: Peng Hao<peng.hao2@zte.com.cn>
> 
> 
>  Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> 
>     ---
>      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
> 

Thanks for the review.
I'd like to include your tag in commit log.
For that, could you please repost your ack in text format using
some other mail client?
My scripts don't handle the way your mail client scrambles text.

> 
> 
> --
> Marc-André Lureau

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost: fix a memory leak
  2017-07-04 22:33 [Qemu-devel] [PATCH] vhost: fix a memory leak Peng Hao
  2017-07-04 14:21 ` Marc-André Lureau
@ 2017-07-04 21:59 ` Marc-André Lureau
  2017-07-04 22:10   ` Michael S. Tsirkin
  1 sibling, 1 reply; 5+ messages in thread
From: Marc-André Lureau @ 2017-07-04 21:59 UTC (permalink / raw)
  To: Peng Hao; +Cc: Michael S. Tsirkin, QEMU

Hi

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

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] vhost: fix a memory leak
  2017-07-04 21:59 ` Marc-André Lureau
@ 2017-07-04 22:10   ` Michael S. Tsirkin
  0 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2017-07-04 22:10 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: Peng Hao, QEMU

On Tue, Jul 04, 2017 at 11:59:54PM +0200, Marc-André Lureau wrote:
> Hi
> 
> On Wed, Jul 5, 2017 at 12:33 AM, Peng Hao <peng.hao2@zte.com.cn> wrote:
> > vhost exists a call for g_file_get_contents, but not call g_free.
> >
> > Signed-off-by: Peng Hao<peng.hao2@zte.com.cn>
> 
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> mst: is this better?

That's fine, thanks!

> > ---
> >  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH] vhost: fix a memory leak
@ 2017-07-04 22:33 Peng Hao
  2017-07-04 14:21 ` Marc-André Lureau
  2017-07-04 21:59 ` Marc-André Lureau
  0 siblings, 2 replies; 5+ messages in thread
From: Peng Hao @ 2017-07-04 22:33 UTC (permalink / raw)
  To: mst; +Cc: qemu-devel, Peng Hao

vhost exists a call for g_file_get_contents, but not call g_free.

Signed-off-by: Peng Hao<peng.hao2@zte.com.cn>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-04 22:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-04 22:33 [Qemu-devel] [PATCH] vhost: fix a memory leak Peng Hao
2017-07-04 14:21 ` Marc-André Lureau
2017-07-04 21:32   ` Michael S. Tsirkin
2017-07-04 21:59 ` Marc-André Lureau
2017-07-04 22:10   ` Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.