libc: memset valid allocations only in calloc()

Fixes #2097
This commit is contained in:
Menno Valkema 2016-09-13 15:52:51 +02:00 committed by Christian Helmuth
parent 99fbb23ec5
commit ff06361c71

View File

@ -192,7 +192,8 @@ extern "C" void *malloc(size_t size)
extern "C" void *calloc(size_t nmemb, size_t size)
{
void *addr = malloc(nmemb*size);
Genode::memset(addr, 0, nmemb*size);
if (addr)
Genode::memset(addr, 0, nmemb*size);
return addr;
}