[PATCH] bridge: Fix resource leak

Patrik Flykt patrik.flykt at linux.intel.com
Tue Nov 13 04:41:35 PST 2012


On Tue, 2012-11-13 at 14:15 +0200, Patrik Flykt wrote:
> 	Hi,
> 
> On Fri, 2012-11-09 at 14:48 +0900, Danny Jeongseok Seo wrote:
> > diff --git a/src/bridge.c b/src/bridge.c
> > index 2849ef7..47467e6 100644
> > --- a/src/bridge.c
> > +++ b/src/bridge.c
> > @@ -76,7 +76,9 @@ int __connman_bridge_create(const char *name)
> >  	if (ioctl(sk, SIOCBRADDBR, name) == -1) {
> >  		err = -errno;
> >  		if (err != -EEXIST)
> > -			return -EOPNOTSUPP;
> > +			err = -EOPNOTSUPP;
> > +
> > +		goto done;
> 
> If the error is EEXIST, the bridge exists already and everything is ok.
> In this case we don't signal an error with the unconditional goto.
> 
> I made the following fix below.

I applied the one below.

	Patrik


> diff --git a/src/bridge.c b/src/bridge.c
> index 2849ef7..e46cdda 100644
> --- a/src/bridge.c
> +++ b/src/bridge.c
> @@ -75,8 +75,10 @@ int __connman_bridge_create(const char *name)
>  
>  	if (ioctl(sk, SIOCBRADDBR, name) == -1) {
>  		err = -errno;
> -		if (err != -EEXIST)
> +		if (err != -EEXIST) {
> +			close(sk);
>  			return -EOPNOTSUPP;
> +		}
>  	}
>  
>  	err = set_forward_delay(name, 0);
> 
> 
> _______________________________________________
> connman mailing list
> connman at connman.net
> http://lists.connman.net/listinfo/connman





More information about the connman mailing list