diff options
| author | Peng Hao <peng.hao2@zte.com.cn> | 2017-07-05 06:33:32 +0800 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2017-08-02 00:13:25 +0300 |
| commit | 08b9e0ba623c4468fe94026a9bdd086526ef62f0 (patch) | |
| tree | f710abd9759b3e184c8e3ae80fef88044eacc824 | |
| parent | 2cef91cf4922cb1ade8882c1097966b090467bbb (diff) | |
| download | focaccia-qemu-08b9e0ba623c4468fe94026a9bdd086526ef62f0.tar.gz focaccia-qemu-08b9e0ba623c4468fe94026a9bdd086526ef62f0.zip | |
vhost: fix a memory leak
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: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
| -rw-r--r-- | hw/virtio/vhost-backend.c | 2 |
1 files changed, 2 insertions, 0 deletions
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; } |