From e6bcb1b61782cefacecc8b9ee7a5f782373dab2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Wed, 27 Jul 2016 01:15:12 +0400 Subject: vhost-user: keep vhost_net after a disconnection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Many code paths assume get_vhost_net() returns non-null. Keep VhostUserState.vhost_net after a successful vhost_net_init(), instead of freeing it in vhost_net_cleanup(). VhostUserState.vhost_net is thus freed before after being recreated or on final vhost_user_cleanup() and there is no need to save the acked features. Signed-off-by: Marc-André Lureau Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- net/tap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'net/tap.c') diff --git a/net/tap.c b/net/tap.c index 40a8c741fc..6abb962efd 100644 --- a/net/tap.c +++ b/net/tap.c @@ -312,6 +312,7 @@ static void tap_cleanup(NetClientState *nc) if (s->vhost_net) { vhost_net_cleanup(s->vhost_net); + g_free(s->vhost_net); s->vhost_net = NULL; } -- cgit v1.2.3