Skip to content

Commit

Permalink
pipeline: fix double free for table stats
Browse files Browse the repository at this point in the history
[ upstream commit 2d9e10932d535ea553081b489a25f6fce7ec7996 ]

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: 742b0a5 ("pipeline: add table statistics to SWX")
Fixes: 4f59d37 ("pipeline: support learner tables")

Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  • Loading branch information
kamalakannanr89 authored and kevintraynor committed Jul 11, 2023
1 parent 4b8a602 commit e531825
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/pipeline/rte_swx_pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -7635,6 +7635,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;
}
}

Expand Down Expand Up @@ -8443,6 +8444,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;
}
}

Expand Down

0 comments on commit e531825

Please sign in to comment.