diff mbox

[ovs-dev,PATCHv2,2/2] ovs-ofctl: fix memory leak reported by valgrind.

Message ID 1486566234-37570-2-git-send-email-u9012063@gmail.com
State Accepted
Headers show

Commit Message

William Tu Feb. 8, 2017, 3:03 p.m. UTC
Testcase 1057 ofproto-dpif - fragment handling - upcall reports
the following leak:
  xrealloc (util.c:123)
  vconn_dump_flows (vconn.c:1030)
  read_flows_from_switch (ovs-ofctl.c:3360)
  ofctl_replace_flows (ovs-ofctl.c:3433)
  ovs_cmdl_run_command__ (command-line.c:115)

Signed-off-by: William Tu <u9012063@gmail.com>
---
 utilities/ovs-ofctl.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Andy Zhou Feb. 8, 2017, 7:24 p.m. UTC | #1
On Wed, Feb 8, 2017 at 7:03 AM, William Tu <u9012063@gmail.com> wrote:
> Testcase 1057 ofproto-dpif - fragment handling - upcall reports
> the following leak:
>   xrealloc (util.c:123)
>   vconn_dump_flows (vconn.c:1030)
>   read_flows_from_switch (ovs-ofctl.c:3360)
>   ofctl_replace_flows (ovs-ofctl.c:3433)
>   ovs_cmdl_run_command__ (command-line.c:115)
>
> Signed-off-by: William Tu <u9012063@gmail.com>
Acked-by: Andy Zhou <azhou@ovn.org>
Ben Pfaff Feb. 8, 2017, 7:40 p.m. UTC | #2
On Wed, Feb 08, 2017 at 11:24:28AM -0800, Andy Zhou wrote:
> On Wed, Feb 8, 2017 at 7:03 AM, William Tu <u9012063@gmail.com> wrote:
> > Testcase 1057 ofproto-dpif - fragment handling - upcall reports
> > the following leak:
> >   xrealloc (util.c:123)
> >   vconn_dump_flows (vconn.c:1030)
> >   read_flows_from_switch (ovs-ofctl.c:3360)
> >   ofctl_replace_flows (ovs-ofctl.c:3433)
> >   ovs_cmdl_run_command__ (command-line.c:115)
> >
> > Signed-off-by: William Tu <u9012063@gmail.com>
> Acked-by: Andy Zhou <azhou@ovn.org>

Andy, do you want to apply these?
Andy Zhou Feb. 8, 2017, 11:26 p.m. UTC | #3
On Wed, Feb 8, 2017 at 11:40 AM, Ben Pfaff <blp@ovn.org> wrote:
> On Wed, Feb 08, 2017 at 11:24:28AM -0800, Andy Zhou wrote:
>> On Wed, Feb 8, 2017 at 7:03 AM, William Tu <u9012063@gmail.com> wrote:
>> > Testcase 1057 ofproto-dpif - fragment handling - upcall reports
>> > the following leak:
>> >   xrealloc (util.c:123)
>> >   vconn_dump_flows (vconn.c:1030)
>> >   read_flows_from_switch (ovs-ofctl.c:3360)
>> >   ofctl_replace_flows (ovs-ofctl.c:3433)
>> >   ovs_cmdl_run_command__ (command-line.c:115)
>> >
>> > Signed-off-by: William Tu <u9012063@gmail.com>
>> Acked-by: Andy Zhou <azhou@ovn.org>
>
> Andy, do you want to apply these?

Yes, pushed both patches to master and branch-2.7.
diff mbox

Patch

diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c
index 4e11623..77332e0 100644
--- a/utilities/ovs-ofctl.c
+++ b/utilities/ovs-ofctl.c
@@ -3375,6 +3375,11 @@  read_flows_from_switch(struct vconn *vconn,
 
         fte_queue(state, &fs->match, fs->priority, version, index);
     }
+
+    for (size_t i = 0; i < n_fses; i++) {
+        free(CONST_CAST(struct ofpact *, fses[i].ofpacts));
+    }
+    free(fses);
 }
 
 static void