[ovs-dev] [PATCH 04/10] ovs-ofctl: Free leaked minimatch

Yifeng Sun pkusunyifeng at gmail.com
Wed Sep 11 21:18:30 UTC 2019


Valgrind reported:

1056: ofproto - bundle with multiple flow mods (OpenFlow 1.4)

==19220== 160 bytes in 2 blocks are definitely lost in loss record 24 of 34
==19220==    at 0x4C2DB8F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19220==    by 0x4979A4: xmalloc (util.c:138)
==19220==    by 0x42407D: miniflow_alloc (flow.c:3340)
==19220==    by 0x4296CF: minimatch_init (match.c:1758)
==19220==    by 0x46273D: parse_ofp_str__ (ofp-flow.c:1759)
==19220==    by 0x465B9E: parse_ofp_str (ofp-flow.c:1790)
==19220==    by 0x465CE0: parse_ofp_flow_mod_str (ofp-flow.c:1817)
==19220==    by 0x465DF6: parse_ofp_flow_mod_file (ofp-flow.c:1876)
==19220==    by 0x410BA3: ofctl_flow_mod_file.isra.19 (ovs-ofctl.c:1773)
==19220==    by 0x417933: ovs_cmdl_run_command__ (command-line.c:223)
==19220==    by 0x406F68: main (ovs-ofctl.c:179)

This patch fixes it.

Signed-off-by: Yifeng Sun <pkusunyifeng at gmail.com>
---
 utilities/ovs-ofctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 754629d3dfbb..06289d296573 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -1724,6 +1724,7 @@ bundle_flow_mod__(const char *remote, struct ofputil_flow_mod *fms,
 
         ovs_list_push_back(&requests, &request->list_node);
         free(CONST_CAST(struct ofpact *, fm->ofpacts));
+        minimatch_destroy(&fm->match);
     }
 
     bundle_transact(vconn, &requests, OFPBF_ORDERED | OFPBF_ATOMIC);
-- 
2.7.4



More information about the dev mailing list