On 12/21/2017 04:13 PM, Tommi Rantala wrote:
> Fix error path memory leak in tipc_enable_bearer().
> 
> Signed-off-by: Tommi Rantala <[email protected]>
> ---
>  net/tipc/bearer.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
> index 47ec121574ce..f3c65e1ec537 100644
> --- a/net/tipc/bearer.c
> +++ b/net/tipc/bearer.c
> @@ -324,6 +324,7 @@ static int tipc_enable_bearer(struct net *net, const char 
> *name,
>       if (res) {
>               pr_warn("Bearer <%s> rejected, enable failure (%d)\n",
>                       name, -res);
> +             kfree(b);
>               return -EINVAL;

Good catch. But after I take a closer look at the code, it's found there
are another similar memory leak in tipc_enable_bearer():

        if (tipc_mon_create(net, bearer_id))
                return -ENOMEM;

So I suggest you should solve it together with it.

Thanks,
Ying

>       }
>  
> 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
tipc-discussion mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tipc-discussion

Reply via email to