On Wed, Feb 23, 2022 at 7:21 PM Han Zhou <[email protected]> wrote:
>
> Fix it by using shash_destroy_free_data() instead of shash_destroy().
>
> Example of asan log of this memory leak:
>
> Direct leak of 232 byte(s) in 29 object(s) allocated from:
>     #0 0x534b0f in malloc
(/home/hanzhou/src/ovn/_build_as/controller/ovn-controller+0x534b0f)
>     #1 0x73bd4d in xmalloc__
/home/hanzhou/src/ovs/_build/../lib/util.c:137:15
>     #2 0x73bd4d in xmalloc
/home/hanzhou/src/ovs/_build/../lib/util.c:172:12
>     #3 0x638c49 in parse_constant_set
/home/hanzhou/src/ovn/_build_as/../lib/expr.c:971:14
>     #4 0x64450d in expr_parse_primary
/home/hanzhou/src/ovn/_build_as/../lib/expr.c:1390:44
>     #5 0x63aefc in expr_parse_not
/home/hanzhou/src/ovn/_build_as/../lib/expr.c:1479:16
>     #6 0x63ac45 in expr_parse__
/home/hanzhou/src/ovn/_build_as/../lib/expr.c:1486:22
>     #7 0x63b500 in expr_parse
/home/hanzhou/src/ovn/_build_as/../lib/expr.c:1535:34
>     #8 0x63b500 in expr_parse_string
/home/hanzhou/src/ovn/_build_as/../lib/expr.c:1557:25
>     #9 0x598a56 in convert_match_to_expr
/home/hanzhou/src/ovn/_build_as/../controller/lflow.c:1240:22
>     #10 0x591c07 in consider_logical_flow__
/home/hanzhou/src/ovn/_build_as/../controller/lflow.c:1407:16
>     #11 0x58d641 in add_logical_flows
/home/hanzhou/src/ovn/_build_as/../controller/lflow.c:393:9
>     #12 0x58d641 in lflow_run
/home/hanzhou/src/ovn/_build_as/../controller/lflow.c:2444:5
>     #13 0x5f57a3 in en_lflow_output_run
/home/hanzhou/src/ovn/_build_as/../controller/ovn-controller.c:2449:5
>     #14 0x65bc04 in engine_recompute
/home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:380:5
>     #15 0x65b2a3 in engine_run_node
/home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:456:17
>     #16 0x65b2a3 in engine_run
/home/hanzhou/src/ovn/_build_as/../lib/inc-proc-eng.c:493:9
>     #17 0x5ef9c1 in main
/home/hanzhou/src/ovn/_build_as/../controller/ovn-controller.c
>     #18 0x7f82418691a1 in __libc_start_main (/lib64/libc.so.6+0x281a1)
>
> Reported-by: Numan Siddique <[email protected]>
> Fixes: aa3e4e8a81 ("lflow: Track reference count of address sets when
parsing lflows.")
> Signed-off-by: Han Zhou <[email protected]>
> ---
>  controller/lflow.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/controller/lflow.c b/controller/lflow.c
> index cf090612f..e169edef1 100644
> --- a/controller/lflow.c
> +++ b/controller/lflow.c
> @@ -1258,7 +1258,7 @@ convert_match_to_expr(const struct
sbrec_logical_flow *lflow,
>          *pg_addr_set_ref = (!sset_is_empty(&port_groups_ref) ||
>                              !shash_is_empty(&addr_sets_ref));
>      }
> -    shash_destroy(&addr_sets_ref);
> +    shash_destroy_free_data(&addr_sets_ref);
>      sset_destroy(&port_groups_ref);
>
>      if (!error) {
> --
> 2.30.2
>

I applied to main to fix the broken CI.

Thanks,
Han
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to