From 430c292030ffda57f122c282d3eb165a97412b91 Mon Sep 17 00:00:00 2001 From: Yifeng Sun Date: Wed, 11 Sep 2019 14:18:30 -0700 Subject: ovs-ofctl: Free leaked minimatch 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. Acked-by: William Tu Signed-off-by: Yifeng Sun Signed-off-by: Ben Pfaff --- utilities/ovs-ofctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 754629d3d..06289d296 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.14.1