From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id C060E58D1 for ; Thu, 11 May 2017 08:49:48 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP; 10 May 2017 23:49:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,323,1491289200"; d="scan'208";a="85448321" Received: from gklab-246-153.igk.intel.com (HELO Sent) ([10.217.246.153]) by orsmga002.jf.intel.com with SMTP; 10 May 2017 23:49:45 -0700 Received: by Sent (sSMTP sendmail emulation); Thu, 11 May 2017 12:31:46 +0200 From: Dariusz Stojaczyk To: dev@dpdk.org Cc: Dariusz Stojaczyk Date: Thu, 11 May 2017 12:23:28 +0200 Message-Id: <1494498209-77217-2-git-send-email-dariuszx.stojaczyk@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494498209-77217-1-git-send-email-dariuszx.stojaczyk@intel.com> References: <1494498209-77217-1-git-send-email-dariuszx.stojaczyk@intel.com> Subject: [dpdk-dev] [PATCH 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: , X-List-Received-Date: Thu, 11 May 2017 06:49:49 -0000 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. Change-Id: I6edff00298a668054f4d106ffdaea828f41912fe Signed-off-by: Dariusz Stojaczyk --- 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 -------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.