Blob Blame History Raw
From b8a33e87955d39b7e354fad6b8317bdcd9568c02 Mon Sep 17 00:00:00 2001
From: Ilya Maximets <i.maximets@ovn.org>
Date: Fri, 20 Nov 2020 01:17:11 +0100
Subject: [PATCH 03/16] northd: Fix leaks of strings while formatting ecmp
 flows.

Result of 'normalize_v46_prefix()' should be freed and all dynamic
strings should be destroyed.

Fixes: 4fdca656857d ("Add ECMP symmetric replies.")
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Numan Siddique <numans@ovn.org>
---
 northd/ovn-northd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index 3884e08eb..0acff2322 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -7800,6 +7800,7 @@ add_ecmp_symmetric_reply_flows(struct hmap *lflows,
                   route->prefix.family == AF_INET ? "4" : "6",
                   route->is_src_route ? "dst" : "src",
                   cidr);
+    free(cidr);
     ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_DEFRAG, 100,
                             ds_cstr(&match), "ct_next;",
                             &st_route->header_);
@@ -7851,6 +7852,10 @@ add_ecmp_symmetric_reply_flows(struct hmap *lflows,
     ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_ARP_RESOLVE,
                             200, ds_cstr(&ecmp_reply),
                             action, &st_route->header_);
+
+    ds_destroy(&match);
+    ds_destroy(&actions);
+    ds_destroy(&ecmp_reply);
 }
 
 static void
-- 
2.28.0