fix simple_malloc malloc(0) behavior not to return non-unique pointers
This commit is contained in:
parent
a23baf586a
commit
598a0147cd
1 changed files with 1 additions and 0 deletions
|
|
@ -15,6 +15,7 @@ void *__simple_malloc(size_t n)
|
||||||
static int lock;
|
static int lock;
|
||||||
size_t align=1;
|
size_t align=1;
|
||||||
|
|
||||||
|
if (!n) return 0;
|
||||||
if (n > SIZE_MAX/2) goto toobig;
|
if (n > SIZE_MAX/2) goto toobig;
|
||||||
|
|
||||||
while (align<n && align<ALIGN)
|
while (align<n && align<ALIGN)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue