Re: [PATCH 1/3] calloc: Fix possible memory leak

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

 



On Mon, Oct 21, 2013 at 09:48:23PM +0400, Alexander Shiyan wrote:
> 
> Signed-off-by: Alexander Shiyan <shc_work@xxxxxxx>

Applied all, thanks

Sascha

> ---
>  common/dlmalloc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common/dlmalloc.c b/common/dlmalloc.c
> index 7ad368e..b4341fe 100644
> --- a/common/dlmalloc.c
> +++ b/common/dlmalloc.c
> @@ -1750,11 +1750,11 @@ void *calloc(size_t n, size_t elem_size)
>  	mchunkptr oldtop = top;
>  	INTERNAL_SIZE_T oldtopsize = chunksize(top);
>  
> -	void *mem = malloc(sz);
> -
>  	if ((long)n < 0)
>  		return NULL;
>  
> +	void *mem = malloc(sz);
> +
>  	if (!mem)
>  		return NULL;
>  	else {
> -- 
> 1.8.1.5
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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