From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jasvinder.singh@intel.com>
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id 567AC1F1A
 for <dev@dpdk.org>; Mon, 22 Jan 2018 15:01:42 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 22 Jan 2018 06:01:40 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.46,396,1511856000"; d="scan'208";a="21617834"
Received: from silpixa00381635.ir.intel.com (HELO
 silpixa00381635.ger.corp.intel.com) ([10.237.222.149])
 by FMSMGA003.fm.intel.com with ESMTP; 22 Jan 2018 06:01:39 -0800
From: Jasvinder Singh <jasvinder.singh@intel.com>
To: dev@dpdk.org
Cc: bernard.iremonger@intel.com,
	john.mcnamara@intel.com
Date: Mon, 22 Jan 2018 14:14:28 +0000
Message-Id: <20180122141428.106166-1-jasvinder.singh@intel.com>
X-Mailer: git-send-email 2.9.3
Subject: [dpdk-dev] [PATCH] lib/librte_flow_classify: fix memory leak issue
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jan 2018 14:01:42 -0000

Free allocated memory of the rule if not added to the table.

Fixes: 50bdac5916d9 ("flow_classify: remove table id parameter from API")
Coverity issue: 257032

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
---
 lib/librte_flow_classify/rte_flow_classify.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_flow_classify/rte_flow_classify.c b/lib/librte_flow_classify/rte_flow_classify.c
index 6fa6a74..55492a6 100644
--- a/lib/librte_flow_classify/rte_flow_classify.c
+++ b/lib/librte_flow_classify/rte_flow_classify.c
@@ -560,6 +560,7 @@ rte_flow_classify_table_entry_add(struct rte_flow_classifier *cls,
 			return rule;
 		}
 	}
+	free(rule);
 	return NULL;
 }
 
-- 
2.9.3