From: Numan Siddique <num...@ovn.org>

Otherwise there would be a memory leak if
icnbrec_transit_switch_index_find() returns NULL.

Fixes: cf1b9920c48e("ovn-ic: fix potential segmentation violation when ts is 
deleted")
Signed-off-by: Numan Siddique <num...@ovn.org>
---
 ic/ovn-ic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index eec466ec4f..9c7b236cb4 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -1638,11 +1638,11 @@ collect_lr_routes(struct ic_context *ctx,
         icnbrec_transit_switch_index_set_name(key, isb_pb->transit_switch);
         t_sw = icnbrec_transit_switch_index_find(
              ctx->icnbrec_transit_switch_by_name, key);
+        icnbrec_transit_switch_index_destroy_row(key);
         if (!t_sw) {
             continue;
         }
         ts_name = t_sw->name;
-        icnbrec_transit_switch_index_destroy_row(key);
         routes_ad = shash_find_data(routes_ad_by_ts, ts_name);
         if (!routes_ad) {
             routes_ad = xzalloc(sizeof *routes_ad);
-- 
2.41.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to