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 12F8142970; Mon, 17 Apr 2023 21:00:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D0D042B8C; Mon, 17 Apr 2023 21:00:02 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id ECE3040698; Mon, 17 Apr 2023 21:00:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681758001; x=1713294001; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=nGfYDkKp8yiuVr2in559C9fr/qeYMmH7MzubkGPxqW4=; b=GtAKZDbLrF7hXiZUzYsvf/+1WIx/Fvu+mWfNYULuy45BFCBEtaX/polp Ou3//f8WrGfsrDTS40pqYl+ZEK5+1dPip/Iemj52Yexk/HXdfVE8jAdgl wA/eRoQWCtlDdEjieMtmj9L6sG8XXpv2etyOgxftsh6CrVMQtFi3RG+tu DTJx584T301Ws2YAx9hAaMQUCDNSeXohYNm3NxdVEhF68I8qWjEKFInY9 T+9/dvF2tKl1Y+5m5of+eIqEEulC1rKLuo4BCh24kw+VhTPlCkA7MucDA +iLZCfyCQmCxIYXe/8orErUxwH+UpdDVIfNKeZUGHOkGKn66MB9AdlQ+p A==; X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="372861326" X-IronPort-AV: E=Sophos;i="5.99,204,1677571200"; d="scan'208";a="372861326" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2023 11:59:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="760059166" X-IronPort-AV: E=Sophos;i="5.99,204,1677571200"; d="scan'208";a="760059166" Received: from wp-ena2.iind.intel.com ([10.190.189.155]) by fmsmga004.fm.intel.com with ESMTP; 17 Apr 2023 11:59:58 -0700 From: Kamalakannan R To: dev@dpdk.org Cc: harshad.suresh.narayane@intel.com, stable@dpdk.org, Cristian Dumitrescu Subject: [PATCH v3] pipeline: fix double free error for table stats Date: Mon, 17 Apr 2023 16:52:43 +0530 Message-Id: <20230417112243.727023-1-kamalakannan.r@intel.com> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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") Cc: stable@dpdk.org 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