mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-28 15:40:29 +09:00
malloc_simple: calloc: don't call memset if malloc failed
malloc_simple() can return 0 if out of memory. Don't call memset from calloc() in this case but rely on the caller checking the return value. Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Reviewed-by: Marek Vasut <marex@denx.de>
This commit is contained in:
parent
a5e34fc0b6
commit
f3da76ea8b
@ -57,6 +57,7 @@ void *calloc(size_t nmemb, size_t elem_size)
|
|||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
ptr = malloc(size);
|
ptr = malloc(size);
|
||||||
|
if (ptr)
|
||||||
memset(ptr, '\0', size);
|
memset(ptr, '\0', size);
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user