[ovs-dev] [PATCH 3/3] ovs-ofctl: Fix memory leak in bundle_print_errors().

Yi-Hung Wei yihung.wei at gmail.com
Mon Nov 21 21:42:41 UTC 2016


In testcase "ofproto - bundle group mod with mod and add_or_mod command",
valgrind reports a memory leak with the following call stack.
    xmalloc (util.c:112)
    ofpbuf_resize__ (ofpbuf.c:246)
    ofpbuf_push_uninit (ofpbuf.c:436)
    ofpbuf_push (ofpbuf.c:459)
    ofperr_decode_msg (ofp-errors.c:332)
    bundle_print_errors (ovs-ofctl.c:692)
    bundle_transact.constprop.25 (ovs-ofctl.c:728)
    bundle_group_mod__ (ovs-ofctl.c:2663)
    ofctl_group_mod__ (ovs-ofctl.c:2681)
    ofctl_group_mod (ovs-ofctl.c:2736)
    ovs_cmdl_run_command__ (command-line.c:115)
    main (ovs-ofctl.c:151)

Signed-off-by: Yi-Hung Wei <yihung.wei 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 29b324b..7f5bb61 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -714,6 +714,7 @@ bundle_print_errors(struct ovs_list *errors, struct ovs_list *requests)
             fprintf(stderr, "Error %s for: ", ofperr_get_name(ofperr));
             ofp_print(stderr, ofp_msg, msg_len, verbosity + 1);
         }
+        ofpbuf_uninit(&payload);
         free(error);
     }
     fflush(stderr);
-- 
2.7.4



More information about the dev mailing list