The error path for parsing dynamic-routing-port-mapping freed the
duplicated port_mapping string, but the same string was also freed
at the end of the function every time. Keep only single free at the
end of the function.

This was detected by Coverity:
** CID 456737:  Memory - corruptions  (USE_AFTER_FREE)
/controller/route.c: 100 in build_port_mapping()

Fixes: d7d886eca553 ("controller: Support learning routes per iface.")
Signed-off-by: Ales Musil <[email protected]>
---
 controller/route.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/controller/route.c b/controller/route.c
index e7f101ab4..57af1ed91 100644
--- a/controller/route.c
+++ b/controller/route.c
@@ -92,7 +92,6 @@ build_port_mapping(struct smap *mapping, const char 
*port_mapping)
           static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 1);
           VLOG_WARN_RL(&rl, "dynamic-routing-port-mapping setting '%s' is "
                             "not valid.", tokstr);
-          free(orig);
           break;
         }
         smap_add(mapping, key, value);
-- 
2.48.1

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

Reply via email to