vhost: fix use after free

Fix the coverity USE_AFTER_FREE issue.

Coverity issue: 137884
Fixes: a277c7159876 ("vhost: refactor code structure")

Reported-by: John McNamara <john.mcnamara@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
This commit is contained in:
Yuanhan Liu 2016-10-18 22:38:06 +08:00
parent f2f5bc8f30
commit 54524e0391

View File

@ -250,8 +250,8 @@ vhost_user_read_cb(int connfd, void *dat, int *remove)
vsocket->connfd = -1;
close(connfd);
*remove = 1;
free(conn);
vhost_destroy_device(conn->vid);
free(conn);
if (vsocket->reconnect)
vhost_user_create_client(vsocket);