ebb439
From a614f338a280aa180b1b8d818c7571269164827b Mon Sep 17 00:00:00 2001
ebb439
From: Ilya Maximets <i.maximets@ovn.org>
ebb439
Date: Fri, 20 Nov 2020 01:17:14 +0100
ebb439
Subject: [PATCH 06/16] actions: Fix leak of select group members.
ebb439
ebb439
'dsts' should be freed in case of any error.
ebb439
ebb439
  Direct leak of 4 byte(s) in 1 object(s) allocated from:
ebb439
    #0 0x502378 in realloc (/tests/ovstest+0x502378)
ebb439
    #1 0x622826 in xrealloc /lib/util.c:149:9
ebb439
    #2 0x8194f4 in parse_select_action /lib/actions.c:1185:20
ebb439
    #3 0x814f49 in parse_set_action /lib/actions.c:3499:13
ebb439
    #4 0x814341 in parse_action /lib/actions.c:3554:9
ebb439
    #5 0x8139ef in parse_actions /lib/actions.c:3643:14
ebb439
    #6 0x8136a3 in ovnacts_parse /lib/actions.c:3678:9
ebb439
    #7 0x813c80 in ovnacts_parse_string /lib/actions.c:3705:5
ebb439
    #8 0x53a4e8 in test_parse_actions /tests/test-ovn.c:1321:17
ebb439
    #9 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
ebb439
    #10 0x537c75 in test_ovn_main /tests/test-ovn.c:1630:5
ebb439
    #11 0x54e7a8 in ovs_cmdl_run_command__ /lib/command-line.c:247:17
ebb439
    #12 0x537359 in main /tests/ovstest.c:133:9
ebb439
    #13 0x7f9ce05ba1a2 in __libc_start_main (/lib64/libc.so.6+0x271a2)
ebb439
ebb439
CC: Han Zhou <hzhou@ovn.org>
ebb439
Fixes: 85b3544aabb2 ("ovn-controller: A new action "select".")
ebb439
Acked-by: Dumitru Ceara <dceara@redhat.com>
ebb439
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
ebb439
Signed-off-by: Numan Siddique <numans@ovn.org>
ebb439
---
ebb439
 lib/actions.c | 1 +
ebb439
 1 file changed, 1 insertion(+)
ebb439
ebb439
diff --git a/lib/actions.c b/lib/actions.c
ebb439
index 0464c51a8..156ebb2fe 100644
ebb439
--- a/lib/actions.c
ebb439
+++ b/lib/actions.c
ebb439
@@ -1188,6 +1188,7 @@ parse_select_action(struct action_context *ctx, struct expr_field *res_field)
ebb439
     }
ebb439
     if (n_dsts <= 1) {
ebb439
         lexer_syntax_error(ctx->lexer, "expecting at least 2 group members");
ebb439
+        free(dsts);
ebb439
         return;
ebb439
     }
ebb439
 
ebb439
-- 
ebb439
2.28.0
ebb439