瀏覽代碼

vhost-user: fix memory leak

g_free() was moved from vhost_net_cleanup in commit e6bcb1b, so we should
free net after vhost_net_cleanup

Signed-off-by: linzhecheng <linzhecheng@huawei.com>
Reviewed-by: Marc-André Lureau < marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
linzhecheng 7 年之前
父節點
當前提交
a38a498dc1
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      net/vhost-user.c

+ 1 - 0
net/vhost-user.c

@@ -109,6 +109,7 @@ static int vhost_user_start(int queues, NetClientState *ncs[], CharBackend *be)
 err:
 err:
     if (net) {
     if (net) {
         vhost_net_cleanup(net);
         vhost_net_cleanup(net);
+        g_free(net);
     }
     }
     vhost_user_stop(i, ncs);
     vhost_user_stop(i, ncs);
     return -1;
     return -1;