app/testpmd: fix multicast address pool leak
authorKe Zhang <ke1x.zhang@intel.com>
Fri, 25 Mar 2022 08:35:55 +0000 (08:35 +0000)
committerFerruh Yigit <ferruh.yigit@xilinx.com>
Wed, 8 Jun 2022 11:53:26 +0000 (13:53 +0200)
commit68629be3a622ee53cd5b40c8447ae9b083ff3f6c
tree2f1813be173c13b6bb0a404f5e15247cfa30f12f
parent1108c33e743f8be81e765165c8b3cf27d57a7220
app/testpmd: fix multicast address pool leak

A multicast address pool is allocated for a port when
using mcast_addr testpmd commands.

When closing a port or stopping testpmd, this pool was
not freed, resulting in a leak.
This issue has been caught using ASan.

Free this pool when closing the port.

Error info as following:
ERROR: LeakSanitizer: detected memory leaksDirect leak of
       192 byte(s)
0 0x7f6a2e0aeffe in __interceptor_realloc
(/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe)
1 0x565361eb340f in mcast_addr_pool_extend
../app/test-pmd/config.c:5162
2 0x565361eb3556 in mcast_addr_pool_append
../app/test-pmd/config.c:5180
3 0x565361eb3aae in mcast_addr_add
../app/test-pmd/config.c:5243

Fixes: 8fff667578a7 ("app/testpmd: new command to add/remove multicast MAC addresses")
Cc: stable@dpdk.org
Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
Acked-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
app/test-pmd/config.c
app/test-pmd/testpmd.c
app/test-pmd/testpmd.h