mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-29 13:03:38 +01:00
stdlib: set errno=ENOMEM after failed malloc()
This commit is contained in:
parent
f7b85f18bd
commit
3046304497
1 changed files with 5 additions and 1 deletions
|
@ -1,8 +1,12 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
extern void *kmalloc(size_t size, char const *arena_name);
|
extern void *kmalloc(size_t size, char const *arena_name);
|
||||||
|
|
||||||
void *malloc(size_t size)
|
void *malloc(size_t size)
|
||||||
{
|
{
|
||||||
return kmalloc(size, NULL);
|
void *ptr = kmalloc(size, NULL);
|
||||||
|
if(ptr == NULL)
|
||||||
|
errno = ENOMEM;
|
||||||
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue