From patchwork Thu May 11 10:56:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Stojaczyk, DariuszX" X-Patchwork-Id: 24219 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 457AF47CE; Thu, 11 May 2017 09:24:14 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 17B641C00 for ; Thu, 11 May 2017 09:24:12 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 May 2017 00:24:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.38,323,1491289200"; d="scan'208"; a="1128904025" Received: from gklab-246-153.igk.intel.com (HELO Sent) ([10.217.246.153]) by orsmga001.jf.intel.com with SMTP; 11 May 2017 00:24:07 -0700 Received: by Sent (sSMTP sendmail emulation); Thu, 11 May 2017 13:06:07 +0200 From: Dariusz Stojaczyk To: dev@dpdk.org Cc: Dariusz Stojaczyk Date: Thu, 11 May 2017 12:56:47 +0200 Message-Id: <1494500208-78788-2-git-send-email-dariuszx.stojaczyk@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494500208-78788-1-git-send-email-dariuszx.stojaczyk@intel.com> References: <1494498209-77217-1-git-send-email-dariuszx.stojaczyk@intel.com> <1494500208-78788-1-git-send-email-dariuszx.stojaczyk@intel.com> Subject: [dpdk-dev] [PATCH v2 2/3] vhost: free virtio_net::guest_pages in vhost_backend_cleanup() 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" guest_pages is being allocated in vhost_setup_mem_table(), reallocated in add_one_guest_page(), but never freed. This patch fixes a memory leak. Signed-off-by: Dariusz Stojaczyk --- Removed Gerrit Change-Id lib/librte_vhost/vhost_user.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c index 5c8058b..2cc0b66 100644 --- a/lib/librte_vhost/vhost_user.c +++ b/lib/librte_vhost/vhost_user.c @@ -114,6 +114,10 @@ vhost_backend_cleanup(struct virtio_net *dev) rte_free(dev->mem); dev->mem = NULL; } + + free(dev->guest_pages); + dev->guest_pages = NULL; + if (dev->log_addr) { munmap((void *)(uintptr_t)dev->log_addr, dev->log_size); dev->log_addr = 0;