From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 401D49B4D for ; Fri, 26 May 2017 10:20:32 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 26 May 2017 01:20:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,396,1491289200"; d="scan'208";a="92068214" Received: from gklab-246-153.igk.intel.com (HELO Sent) ([10.217.246.153]) by orsmga002.jf.intel.com with SMTP; 26 May 2017 01:20:29 -0700 Received: by Sent (sSMTP sendmail emulation); Fri, 26 May 2017 14:01:27 +0200 From: Dariusz Stojaczyk To: dev@dpdk.org Cc: Dariusz Stojaczyk Date: Fri, 26 May 2017 13:59:14 +0200 Message-Id: <1495799955-190227-3-git-send-email-dariuszx.stojaczyk@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495799955-190227-1-git-send-email-dariuszx.stojaczyk@intel.com> References: <1494513192-85863-1-git-send-email-dariuszx.stojaczyk@intel.com> <1495799955-190227-1-git-send-email-dariuszx.stojaczyk@intel.com> Subject: [dpdk-dev] [PATCH v4 2/3] vhost: free 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: , X-List-Received-Date: Fri, 26 May 2017 08:20:32 -0000 This patch fixes a memory leak. virtio_net::guest_pages is allocated in vhost_setup_mem_table(), reallocated in add_one_guest_page(), but never freed. Signed-off-by: Dariusz Stojaczyk --- v2: remove gerrit 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; -- 2.7.4