app/testpmd: fix mbuf leak in the case of multi-segment Tx
Checks
Commit Message
The last mbuf allocated in bulk is never used and never freed.
Fixes: 01b645dcff7f ("app/testpmd: move txonly prepare in separate function")
Fixes: 561ddcf8d099 ("app/testpmd: allocate txonly segments per bulk")
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
app/test-pmd/txonly.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 5/8/2019 11:27 AM, Andrew Rybchenko wrote:
> The last mbuf allocated in bulk is never used and never freed.
>
> Fixes: 01b645dcff7f ("app/testpmd: move txonly prepare in separate function")
> Fixes: 561ddcf8d099 ("app/testpmd: allocate txonly segments per bulk")
>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Good catch!
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied to dpdk-next-net/master, thanks.
@@ -167,7 +167,7 @@
nb_segs = tx_pkt_nb_segs;
if (nb_segs > 1) {
- if (rte_mempool_get_bulk(mbp, (void **)pkt_segs, nb_segs))
+ if (rte_mempool_get_bulk(mbp, (void **)pkt_segs, nb_segs - 1))
return false;
}