public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: fix memory leak in batadv_softif_create_vlan()
@ 2013-08-07 23:07 Antonio Quartulli
  2013-08-08  4:55 ` Marek Lindner
  0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2013-08-07 23:07 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

From: Antonio Quartulli <antonio@open-mesh.com>

Introduced by e4ff5c153dab054a6cd1c4132f87bc5e77127456
("batman-adv: add sysfs framework for VLAN")

Signed-off-by: Antonio Quartulli <antonio@open-mesh.com>
---
 soft-interface.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/soft-interface.c b/soft-interface.c
index 7cd23f5..f813bd5 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -466,8 +466,10 @@ int batadv_softif_create_vlan(struct batadv_priv *bat_priv, unsigned short vid)
 	atomic_set(&vlan->ap_isolation, 0);
 
 	err = batadv_sysfs_add_vlan(bat_priv->soft_iface, vlan);
-	if (err)
+	if (err) {
+		kfree(vlan);
 		return err;
+	}
 
 	spin_lock_bh(&bat_priv->softif_vlan_list_lock);
 	hlist_add_head_rcu(&vlan->list, &bat_priv->softif_vlan_list);
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: fix memory leak in batadv_softif_create_vlan()
  2013-08-07 23:07 [B.A.T.M.A.N.] [PATCH] batman-adv: fix memory leak in batadv_softif_create_vlan() Antonio Quartulli
@ 2013-08-08  4:55 ` Marek Lindner
  2013-08-08  8:27   ` Antonio Quartulli
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Lindner @ 2013-08-08  4:55 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Thursday, August 08, 2013 07:07:28 Antonio Quartulli wrote:
> --- a/soft-interface.c
> +++ b/soft-interface.c
> @@ -466,8 +466,10 @@ int batadv_softif_create_vlan(struct batadv_priv
> *bat_priv, unsigned short vid) atomic_set(&vlan->ap_isolation, 0);
>  
>         err = batadv_sysfs_add_vlan(bat_priv->soft_iface, vlan);
> -       if (err)
> +       if (err) {
> +               kfree(vlan);
>                 return err;
> +       }

You raise a valid point here but what about the local entry that is added 
right above ? Does it require cleanup as well ?

Cheers,
Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batman-adv: fix memory leak in batadv_softif_create_vlan()
  2013-08-08  4:55 ` Marek Lindner
@ 2013-08-08  8:27   ` Antonio Quartulli
  0 siblings, 0 replies; 3+ messages in thread
From: Antonio Quartulli @ 2013-08-08  8:27 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 878 bytes --]

On Thu, Aug 08, 2013 at 12:55:22PM +0800, Marek Lindner wrote:
> On Thursday, August 08, 2013 07:07:28 Antonio Quartulli wrote:
> > --- a/soft-interface.c
> > +++ b/soft-interface.c
> > @@ -466,8 +466,10 @@ int batadv_softif_create_vlan(struct batadv_priv
> > *bat_priv, unsigned short vid) atomic_set(&vlan->ap_isolation, 0);
> >  
> >         err = batadv_sysfs_add_vlan(bat_priv->soft_iface, vlan);
> > -       if (err)
> > +       if (err) {
> > +               kfree(vlan);
> >                 return err;
> > +       }
> 
> You raise a valid point here but what about the local entry that is added 
> right above ? Does it require cleanup as well ?

Good point! Thanks!

I think I will move the tt_local_add right below this if loop.
v2 is coming.

Cheers,


-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-08  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-07 23:07 [B.A.T.M.A.N.] [PATCH] batman-adv: fix memory leak in batadv_softif_create_vlan() Antonio Quartulli
2013-08-08  4:55 ` Marek Lindner
2013-08-08  8:27   ` Antonio Quartulli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox