diff mbox

[ovs-dev,1/3] ovs-ofctl: Fix memory leak in ofctl_packet_out().

Message ID 1479764561-16741-1-git-send-email-yihung.wei@gmail.com
State Accepted
Delegated to: Daniele Di Proietto
Headers show

Commit Message

Yi-Hung Wei Nov. 21, 2016, 9:42 p.m. UTC
In testcase "bfd - bfd decay", valgrind reports a memory leak with the
following call stack.
    xmalloc (util.c:112)
    vconn_stream_new (vconn-stream.c:60)
    vconn_stream_open (vconn-stream.c:85)
    vconn_open (vconn.c:248)
    open_vconn_socket (ovs-ofctl.c:517)
    open_vconn__ (ovs-ofctl.c:553)
    open_vconn (ovs-ofctl.c:587)
    open_vconn_for_flow_mod (ovs-ofctl.c:1416)
    ofctl_packet_out (ovs-ofctl.c:2148)
    ovs_cmdl_run_command__ (command-line.c:115)
    main (ovs-ofctl.c:151)

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
---
 utilities/ovs-ofctl.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 4b8a43c..29b324b 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -2149,6 +2149,7 @@  ofctl_packet_out(struct ovs_cmdl_context *ctx)
                                            usable_protocols);
         opo = ofputil_encode_packet_out(&po, protocol);
         transact_noreply(vconn, opo);
+        vconn_close(vconn);
         free(CONST_CAST(void *, po.packet));
         free(po.ofpacts);
     } else {