diff mbox series

[ovs-dev,ovs-dev,v1,1/2] dpctl: Fix memory leak in dpctl_dump_flows()

Message ID 20200716111445.64483-1-xiangxia.m.yue@gmail.com
State Accepted
Headers show
Series [ovs-dev,ovs-dev,v1,1/2] dpctl: Fix memory leak in dpctl_dump_flows() | expand

Commit Message

Tonghao Zhang July 16, 2020, 11:14 a.m. UTC
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Goto label accurately to avoid memleak.

Fixes: a692410af0f7 ("dpctl: Expand the flow dump type filter")
Cc: Gavi Teitz <gavi@mellanox.com>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 lib/dpctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Roi Dayan July 19, 2020, 8:48 a.m. UTC | #1
On 2020-07-16 2:14 PM, xiangxia.m.yue@gmail.com wrote:
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> Goto label accurately to avoid memleak.
> 
> Fixes: a692410af0f7 ("dpctl: Expand the flow dump type filter")
> Cc: Gavi Teitz <gavi@mellanox.com>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
>  lib/dpctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/dpctl.c b/lib/dpctl.c
> index db2b1f8961aa..09ae97f25cf3 100644
> --- a/lib/dpctl.c
> +++ b/lib/dpctl.c
> @@ -1031,7 +1031,7 @@ dpctl_dump_flows(int argc, const char *argv[], struct dpctl_params *dpctl_p)
>      memset(&dump_types, 0, sizeof dump_types);
>      error = populate_dump_types(types_list, &dump_types, dpctl_p);
>      if (error) {
> -        goto out_free;
> +        goto out_dpifclose;
>      }
>      determine_dpif_flow_dump_types(&dump_types, &dpif_dump_types);
>  
> 

Reviewed-by: Roi Dayan <roid@mellanox.com>
William Tu July 21, 2020, 9:31 p.m. UTC | #2
On Sun, Jul 19, 2020 at 11:48:35AM +0300, Roi Dayan wrote:
> 
> 
> On 2020-07-16 2:14 PM, xiangxia.m.yue@gmail.com wrote:
> > From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > 
> > Goto label accurately to avoid memleak.
> > 
> > Fixes: a692410af0f7 ("dpctl: Expand the flow dump type filter")
> > Cc: Gavi Teitz <gavi@mellanox.com>
> > Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> > ---
> >  lib/dpctl.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/lib/dpctl.c b/lib/dpctl.c
> > index db2b1f8961aa..09ae97f25cf3 100644
> > --- a/lib/dpctl.c
> > +++ b/lib/dpctl.c
> > @@ -1031,7 +1031,7 @@ dpctl_dump_flows(int argc, const char *argv[], struct dpctl_params *dpctl_p)
> >      memset(&dump_types, 0, sizeof dump_types);
> >      error = populate_dump_types(types_list, &dump_types, dpctl_p);
> >      if (error) {
> > -        goto out_free;
> > +        goto out_dpifclose;
> >      }
> >      determine_dpif_flow_dump_types(&dump_types, &dpif_dump_types);
> >  
> > 
> 
> Reviewed-by: Roi Dayan <roid@mellanox.com>

Thanks, applied to master, 2.14, 13, 12, and 11.
William
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

diff --git a/lib/dpctl.c b/lib/dpctl.c
index db2b1f8961aa..09ae97f25cf3 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -1031,7 +1031,7 @@  dpctl_dump_flows(int argc, const char *argv[], struct dpctl_params *dpctl_p)
     memset(&dump_types, 0, sizeof dump_types);
     error = populate_dump_types(types_list, &dump_types, dpctl_p);
     if (error) {
-        goto out_free;
+        goto out_dpifclose;
     }
     determine_dpif_flow_dump_types(&dump_types, &dpif_dump_types);