Skip to content

Commit

Permalink
test: ipsecfwd: fix potential memory leak
Browse files Browse the repository at this point in the history
When tearing down resources, free interface string unconditionally
as teardown logic could be reached before packet I/Os have been opened.

Signed-off-by: Tuomas Taipale <tuomas.taipale@nokia.com>
Reviewed-by: Janne Peltonen <janne.peltonen@nokia.com>
  • Loading branch information
TuomasTaipale authored and MatiasElo committed Sep 19, 2023
1 parent 1a2b335 commit abcdc5e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/performance/odp_ipsecfwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1933,11 +1933,12 @@ static void teardown_test(const prog_config_t *config)
{
(void)odph_iplookup_table_destroy(config->fwd_tbl);

for (uint32_t i = 0U; i < config->num_ifs; ++i)
if (config->pktios[i].handle != ODP_PKTIO_INVALID) {
for (uint32_t i = 0U; i < config->num_ifs; ++i) {
free(config->pktios[i].name);

if (config->pktios[i].handle != ODP_PKTIO_INVALID)
(void)odp_pktio_close(config->pktios[i].handle);
free(config->pktios[i].name);
}
}

if (config->pktio_pool != ODP_POOL_INVALID)
(void)odp_pool_destroy(config->pktio_pool);
Expand Down

0 comments on commit abcdc5e

Please sign in to comment.