libc: Check for NULL pointers in free()
POSIX says that the free() function should simply do nothing if a NULL pointer argument has been specified. So let's be a little bit more compliant in our libc and add a NULL pointer check here, too. Reviewed-by: Greg Kurz <groug@kaod.org> Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
This commit is contained in:
parent
f5825039ff
commit
232eb915d1
|
@ -19,8 +19,10 @@ free(void *ptr)
|
|||
{
|
||||
struct chunk *header;
|
||||
|
||||
if (!ptr)
|
||||
return;
|
||||
|
||||
header = (struct chunk *) ptr;
|
||||
header--;
|
||||
header->inuse = 0;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue