This patch fixes the memory deallocation issue which happened
after unsuccessful allocation (e.g. due to the out of memory)
and produced the segmentation fault.
Fixes:
424dd6c8c1 ("app/compress-perf: add weak functions for multicore test")
Cc: stable@dpdk.org
Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
{
uint32_t i;
- for (i = 0; i < mem->total_bufs; i++) {
- rte_pktmbuf_free(mem->comp_bufs[i]);
- rte_pktmbuf_free(mem->decomp_bufs[i]);
- }
+ if (mem->decomp_bufs != NULL)
+ for (i = 0; i < mem->total_bufs; i++)
+ rte_pktmbuf_free(mem->decomp_bufs[i]);
+
+ if (mem->comp_bufs != NULL)
+ for (i = 0; i < mem->total_bufs; i++)
+ rte_pktmbuf_free(mem->comp_bufs[i]);
rte_free(mem->decomp_bufs);
rte_free(mem->comp_bufs);