[Qemu-devel] [PULL 4/4] vhost-user: delete net client if necessary

Jason Wang posted 4 patches 7 years, 6 months ago
There is a newer version of this series
[Qemu-devel] [PULL 4/4] vhost-user: delete net client if necessary
Posted by Jason Wang 7 years, 6 months ago
From: linzhecheng <linzhecheng@huawei.com>

As qemu_new_net_client create new ncs but error happens later,
ncs will be left in global net_clients list and we can't use them any
more, so we need to cleanup them.

Cc: qemu-stable@nongnu.org
Signed-off-by: linzhecheng <linzhecheng@huawei.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 net/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/vhost-user.c b/net/vhost-user.c
index 608b837..a39f9c9 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -345,6 +345,9 @@ err:
             s->vhost_user = NULL;
         }
     }
+    if (nc0) {
+        qemu_del_net_client(nc0);
+    }
 
     return -1;
 }
-- 
2.7.4