Skip to content

Commit

Permalink
actions: Fix leak of child ports in fwd group.
Browse files Browse the repository at this point in the history
'child_port_list' is an array of pointers that should be freed too.

  Direct leak of 30 byte(s) in 6 object(s) allocated from:
    #0 0x501fff in malloc (/tests/ovstest+0x501fff)
    #1 0x6227e6 in xmalloc /lib/util.c:138:15
    #2 0x6228b8 in xmemdup0 /lib/util.c:168:15
    #3 0x8183d6 in parse_fwd_group_action /lib/actions.c:3374:30
    #4 0x814b6e in parse_action /lib/actions.c:3610:9
    #5 0x8139ef in parse_actions /lib/actions.c:3637:14
    #6 0x8136a3 in ovnacts_parse /lib/actions.c:3672:9
    #7 0x813c80 in ovnacts_parse_string /lib/actions.c:3699:5
    #8 0x53a979 in test_parse_actions /tests/test-ovn.c:1372:21
    #9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
    #11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
    #12 0x537359 in main /tests/ovstest.c:133:9
    #13 0x7f06978f21a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)

CC: Manoj Sharma <manoj.sharma@nutanix.com>
Fixes: edb2400 ("Forwarding group to load balance l2 traffic with liveness detection")
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>

(cherry-picked from master commit 9443464)
  • Loading branch information
igsilya authored and numansiddique committed Nov 22, 2020
1 parent f378bf3 commit abdb605
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/actions.c
Expand Up @@ -3255,6 +3255,9 @@ parse_fwd_group_action(struct action_context *ctx)
lexer_syntax_error(ctx->lexer,
"expecting logical switch port");
if (child_port_list) {
for (int i = 0; i < n_child_ports; i++) {
free(child_port_list[i]);
}
free(child_port_list);
}
return;
Expand Down Expand Up @@ -3360,6 +3363,9 @@ encode_FWD_GROUP(const struct ovnact_fwd_group *fwd_group,
static void
ovnact_fwd_group_free(struct ovnact_fwd_group *fwd_group)
{
for (int i = 0; i < fwd_group->n_child_ports; i++) {
free(fwd_group->child_ports[i]);
}
free(fwd_group->child_ports);
}

Expand Down

0 comments on commit abdb605

Please sign in to comment.