diff mbox series

vhost-user: delete net client if necessary

Message ID 20180611073151.16956-1-linzhecheng@huawei.com
State New
Headers show
Series vhost-user: delete net client if necessary | expand

Commit Message

linzhecheng June 11, 2018, 7:31 a.m. UTC
As qemu_new_net_client create new ncs but error happens later,
ncs will be left in global net_clients list, so we need to cleanup them.

Signed-off-by: linzhecheng <linzhecheng@huawei.com>

Comments

Jason Wang June 12, 2018, 2:11 a.m. UTC | #1
On 2018年06月11日 15:31, linzhecheng wrote:
> As qemu_new_net_client create new ncs but error happens later,
> ncs will be left in global net_clients list, so we need to cleanup them.
>
> Signed-off-by: linzhecheng <linzhecheng@huawei.com>
>
> diff --git a/net/vhost-user.c b/net/vhost-user.c
> index 608b837175..1c7ee48b60 100644
> --- a/net/vhost-user.c
> +++ b/net/vhost-user.c
> @@ -345,6 +345,7 @@ err:
>               s->vhost_user = NULL;
>           }
>       }
> +    qemu_del_net_client(nc0);
>   
>       return -1;
>   }

Can nc0 be NULL here?

And please try to use "Fixes:" tag to ease stable maintenance.

Thanks
diff mbox series

Patch

diff --git a/net/vhost-user.c b/net/vhost-user.c
index 608b837175..1c7ee48b60 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -345,6 +345,7 @@  err:
             s->vhost_user = NULL;
         }
     }
+    qemu_del_net_client(nc0);
 
     return -1;
 }