From 74cb32e3c25732aff687b31f97f4816f3bc79919 Mon Sep 17 00:00:00 2001 From: William Tu Date: Mon, 4 Jan 2016 16:18:40 -0800 Subject: [PATCH] ovs-ofctl: Fix memory leak reported by valgrind. Test case: ovs-ofctl replace-flows with --bundle(376) reports two leaks: ofpbuf_new(ofpbuf.c:151) ofpraw_alloc_xid(ofp-msgs.c:533) ofpraw_alloc(ofp-msgs.c:525) ofputil_encode_flow_mod(ofp-util.c:2290) bundle_flow_mod__(ovs-ofctl.c:1312) ofctl_flow_mod__(ovs-ofctl.c:1331) ofctl_flow_mod_file.isra.13(ovs-ofctl.c:1365) ovs_cmdl_run_command(command-line.c:121) main(ovs-ofctl.c:135) and ofpraw_alloc(ofp-msgs.c:525) ofputil_encode_flow_mod(ofp-util.c:2290) fte_make_flow_mod(ovs-ofctl.c:2936) ofctl_replace_flows(ovs-ofctl.c:2981) ovs_cmdl_run_command(command-line.c:121) main(ovs-ofctl.c:135) Signed-off-by: William Tu Signed-off-by: Daniele Di Proietto Co-authored-by: Daniele Di Proietto Signed-off-by: Ben Pfaff --- utilities/ovs-ofctl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 4ab83b9aa..70f144059 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -1316,6 +1316,7 @@ bundle_flow_mod__(const char *remote, struct ofputil_flow_mod *fms, } bundle_transact(vconn, &requests, OFPBF_ORDERED | OFPBF_ATOMIC); + ofpbuf_list_delete(&requests); vconn_close(vconn); } @@ -2981,6 +2982,8 @@ ofctl_replace_flows(struct ovs_cmdl_context *ctx) } else { transact_multiple_noreply(vconn, &requests); } + + ofpbuf_list_delete(&requests); vconn_close(vconn); fte_free_all(&tables); -- 2.20.1