From patchwork Wed Jan 4 03:57:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yong Wang X-Patchwork-Id: 18819 X-Patchwork-Delegate: yuanhan.liu@linux.intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 6DA282BB9; Wed, 4 Jan 2017 03:53:15 +0100 (CET) Received: from mx5.zte.com.cn (mx5.zte.com.cn [63.217.80.70]) by dpdk.org (Postfix) with ESMTP id 4A86C2B9C for ; Wed, 4 Jan 2017 03:53:12 +0100 (CET) X-MAILFROM: X-RCPTTO: X-FROMIP: 10.30.3.20 X-SEG-Scaned: 1 X-Received: unknown,10.30.3.20,20170104104913 Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 4 Jan 2017 02:49:13 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v042quUf097301; Wed, 4 Jan 2017 10:52:56 +0800 (GMT-8) (envelope-from wang.yong19@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.43.166.165]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017010410525938-751739 ; Wed, 4 Jan 2017 10:52:59 +0800 From: Yong Wang To: yuanhan.liu@linux.intel.com Cc: dev@dpdk.org, Yong Wang Date: Tue, 3 Jan 2017 22:57:55 -0500 Message-Id: <1483502275-18482-1-git-send-email-wang.yong19@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-01-04 10:52:59, Serialize by Router on notes_smtp/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-01-04 10:52:38, Serialize complete at 2017-01-04 10:52:38 X-MAIL: mse01.zte.com.cn v042quUf097301 X-HQIP: 127.0.0.1 Subject: [dpdk-dev] [PATCH] lib/librte_vhost: fix memory leak X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" In function vhost_new_device(), current code dose not free 'dev' in "i == MAX_VHOST_DEVICE" condition statements. It will lead to a memory leak. Signed-off-by: Yong Wang --- lib/librte_vhost/vhost.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 31825b8..e415093 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -250,6 +250,7 @@ struct virtio_net * if (i == MAX_VHOST_DEVICE) { RTE_LOG(ERR, VHOST_CONFIG, "Failed to find a free slot for new device.\n"); + rte_free(dev); return -1; }