From 54524e0391deabbb55e478d4a27d8983ff0b353a Mon Sep 17 00:00:00 2001 From: Yuanhan Liu Date: Tue, 18 Oct 2016 22:38:06 +0800 Subject: [PATCH] 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 Signed-off-by: Yuanhan Liu --- lib/librte_vhost/socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index 967cb65379..aaa9c27077 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -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); -- 2.20.1