From 0006b3389d43d5f3d55b895a9f856106cd28085e Mon Sep 17 00:00:00 2001 From: Ilya Maximets Date: Fri, 20 Nov 2020 01:17:19 +0100 Subject: [PATCH 11/16] northd: Fix leak of dynamic string for fwd group ports. 'group_ports' never destroyed and re-created on each iteration. CC: Manoj Sharma Fixes: edb240081518 ("Forwarding group to load balance l2 traffic with liveness detection") Acked-by: Dumitru Ceara Signed-off-by: Ilya Maximets Signed-off-by: Numan Siddique (cherry-picked from master commit 44f41669812c633bc180074e6d91e0d0f3a781a1) --- northd/ovn-northd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c index 0acff2322..23ad7ba7f 100644 --- a/northd/ovn-northd.c +++ b/northd/ovn-northd.c @@ -5960,6 +5960,7 @@ build_fwd_group_lflows(struct ovn_datapath *od, struct hmap *lflows) { struct ds match = DS_EMPTY_INITIALIZER; struct ds actions = DS_EMPTY_INITIALIZER; + struct ds group_ports = DS_EMPTY_INITIALIZER; for (int i = 0; i < od->nbs->n_forwarding_groups; ++i) { const struct nbrec_forwarding_group *fwd_group = NULL; @@ -5993,7 +5994,7 @@ build_fwd_group_lflows(struct ovn_datapath *od, struct hmap *lflows) ds_put_format(&match, "eth.dst == %s", fwd_group->vmac); /* Create a comma separated string of child ports */ - struct ds group_ports = DS_EMPTY_INITIALIZER; + ds_clear(&group_ports); if (fwd_group->liveness) { ds_put_cstr(&group_ports, "liveness=\"true\","); } @@ -6013,6 +6014,7 @@ build_fwd_group_lflows(struct ovn_datapath *od, struct hmap *lflows) ds_destroy(&match); ds_destroy(&actions); + ds_destroy(&group_ports); } static void -- 2.28.0