All of lore.kernel.org
 help / color / mirror / Atom feed
* [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.