From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id B4E738043 for ; Tue, 16 Dec 2014 18:30:34 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 16 Dec 2014 09:05:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,862,1389772800"; d="scan'208";a="429724459" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 16 Dec 2014 08:54:19 -0800 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id sBGH5Net016609; Tue, 16 Dec 2014 17:05:23 GMT Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id sBGH5Nhg017939; Tue, 16 Dec 2014 17:05:23 GMT Received: (from kananye1@localhost) by sivswdev02.ir.intel.com with id sBGH5Nk4017935; Tue, 16 Dec 2014 17:05:23 GMT From: Konstantin Ananyev To: dev@dpdk.org Date: Tue, 16 Dec 2014 17:05:08 +0000 Message-Id: <1418749508-17748-1-git-send-email-konstantin.ananyev@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dpdk-dev] [PATCH] l3fwd-acl: fix possible memory leak. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2014 17:30:35 -0000 At error app_acl_init() can return without freeing dynamically allocated memory. Not really a big problem, as if app_acl_init() fails, then application would terminate immediately anyway. Though it is a good coding practise to make a function to cleanup after itself. Signed-off-by: Konstantin Ananyev --- examples/l3fwd-acl/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 4487c95..022ccab 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -1247,6 +1247,10 @@ app_acl_init(void) acl_log("Socket %d of lcore %u is out " "of range %d\n", socketid, lcore_id, NB_SOCKETS); + free(route_base_ipv4); + free(route_base_ipv6); + free(acl_base_ipv4); + free(acl_base_ipv6); return -1; } -- 1.8.5.3