The error string returned by ip_parse_masked() and ipv6_parse_masked() was
not freed leading to a memory leak.

Fixes: 32f5ebb06226 ("ovn-northd: Limit ARP/ND broadcast domain whenever 
possible.")
Signed-off-by: Dumitru Ceara <[email protected]>
---
 northd/ovn-northd.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index ddfcebe..4c23158 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -6243,13 +6243,17 @@ build_lswitch_rport_arp_req_flows(struct ovn_port *op,
         struct in6_addr ipv6;
         struct in6_addr mask_v6;
 
-        if (ip_parse_masked(nat->external_ip, &ip, &mask)) {
-            if (!ipv6_parse_masked(nat->external_ip, &ipv6, &mask_v6)) {
+        char *error = ip_parse_masked(nat->external_ip, &ip, &mask);
+        if (error) {
+            free(error);
+            error = ipv6_parse_masked(nat->external_ip, &ipv6, &mask_v6);
+            if (!error) {
                 sset_add(&all_ips_v6, nat->external_ip);
             }
         } else {
             sset_add(&all_ips_v4, nat->external_ip);
         }
+        free(error);
     }
 
     if (!sset_is_empty(&all_ips_v4)) {

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

Reply via email to