Re: [PATCH] ratp: avoid using already freed memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 02, 2017 at 05:48:28PM +0200, Aleksander Morgado wrote:
> If ratp_establish() fails we would be accessing the ratp_internal
> struct after having disposed it.
> 
> Signed-off-by: Aleksander Morgado <aleksander@xxxxxxxxxxxxx>
> ---
>  lib/ratp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/lib/ratp.c b/lib/ratp.c
> index d596a0e8b..22e83636f 100644
> --- a/lib/ratp.c
> +++ b/lib/ratp.c
> @@ -1658,6 +1658,8 @@ int ratp_establish(struct ratp *ratp, bool active, int timeout_ms)
>  	}
>  
>  out:
> +	ri->in_ratp--;
> +
>  	if (ret) {
>  		free(ri->recvbuf);
>  		free(ri->sendbuf);
> @@ -1665,8 +1667,6 @@ out:
>  		ratp->internal = NULL;
>  	}
>  
> -	ri->in_ratp--;
> -
>  	return ret;
>  }
>  
> -- 
> 2.13.0
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux