From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: [PATCH] vhost: fix use after free issue Date: Tue, 18 Oct 2016 22:38:06 +0800 Message-ID: <1476801486-4618-1-git-send-email-yuanhan.liu@linux.intel.com> Cc: John McNamara , Yuanhan Liu To: dev@dpdk.org Return-path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 667A12C0C for ; Tue, 18 Oct 2016 16:37:12 +0200 (CEST) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fix the coverity USE_AFTER_FREE issue. Fixes: a277c7159876 ("vhost: refactor code structure") Coverity issue: 137884 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 967cb65..aaa9c27 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); -- 1.9.0