From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0982A4296F for ; Mon, 17 Apr 2023 16:08:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 01EAE41144; Mon, 17 Apr 2023 16:08:43 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 7546B40698; Mon, 17 Apr 2023 16:08:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681740519; x=1713276519; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=sN/7+HaqGGtw6UsJudKisT8ND4wZDgXhMuHEC/vAYII=; b=RCrC2beCcw0jGrYg+v64huRXZ1SdgayHXmnfxyvAZ7FqbP7swVlTBAQo aymXxpOEYI3f3E9VzIQRMUwRkfzrYcD2KNhg5vq2Rz5dkL3Xrs8XSA9ED BCJvklMPvUkfddCw5RL62nx17mahWSdL/3Oi/VsVGjfvlV86lLEvVgVqt xpmYk8HhqSIBDxJJ4nDkG7rRXXWetHiqnz2YYhojrayu9m5QHIPd87phJ WSjKNHMKvXbnvuUrJbVts3RS6EQQfJHvlq655hkuWbIlhsbLw5vmqJ5Ca soe1SPuRcOJbBI1Ss7G20cAKYGwcXDDBrqdA532Ajg+C16HZRXDxlVl2O Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="333698520" X-IronPort-AV: E=Sophos;i="5.99,204,1677571200"; d="scan'208";a="333698520" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2023 07:07:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="936838920" X-IronPort-AV: E=Sophos;i="5.99,204,1677571200"; d="scan'208";a="936838920" Received: from wp-ena2.iind.intel.com ([10.190.189.155]) by fmsmga006.fm.intel.com with ESMTP; 17 Apr 2023 07:07:54 -0700 From: kamalakannan R To: dev@dpdk.org Cc: stable@dpdk.org, cristian.dumitrescu@intel.com, harshad.suresh.narayane@intel.com, kamalakannanr89 Subject: [PATCH] pipeline: fix double free error for table stats Date: Mon, 17 Apr 2023 12:01:10 +0530 Message-Id: <20230417063110.723751-1-kamalakannan.r@intel.com> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: kamalakannanr89 The pointer to the table statistics data structure needs to be set to NULL after free inside the table_build_free(), as this function is called from multiple places, leading to double memory free error. Similar fix for the learner_build_free() function. Fixes: 742b0a57f50 ("pipeline: add table statistics to SWX") Fixes: 4f59d372614 ("pipeline: support learner tables") Signed-off-by: Kamalakannan R Acked-by: Cristian Dumitrescu --- lib/pipeline/rte_swx_pipeline.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c index dea1378095..da37eda231 100644 --- a/lib/pipeline/rte_swx_pipeline.c +++ b/lib/pipeline/rte_swx_pipeline.c @@ -8665,6 +8665,7 @@ table_build_free(struct rte_swx_pipeline *p) free(p->table_stats[i].n_pkts_action); free(p->table_stats); + p->table_stats = NULL; } } @@ -9579,6 +9580,7 @@ learner_build_free(struct rte_swx_pipeline *p) free(p->learner_stats[i].n_pkts_action); free(p->learner_stats); + p->learner_stats = NULL; } } -- 2.34.3