From: Peng Hao Date: Tue, 4 Jul 2017 22:33:32 +0000 (+0800) Subject: vhost: fix a memory leak X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=08b9e0ba623c4468fe94026a9bdd086526ef62f0;p=qemu.git vhost: fix a memory leak vhost exists a call for g_file_get_contents, but not call g_free. Signed-off-by: Peng Hao Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Marc-André Lureau --- diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c index cb055e8f21..7f09efab8b 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; }