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