mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Abort on attempts to allocate zero bytes
http://marc.info/?t=124267873300015&r=1&w=2 Signed-off-by: malc <av1474@comtv.ru>
This commit is contained in:
+7
-2
@@ -43,6 +43,8 @@ void qemu_free(void *ptr)
|
||||
|
||||
void *qemu_malloc(size_t size)
|
||||
{
|
||||
if (!size)
|
||||
abort();
|
||||
return oom_check(malloc(size));
|
||||
}
|
||||
|
||||
@@ -50,8 +52,11 @@ void *qemu_realloc(void *ptr, size_t size)
|
||||
{
|
||||
if (size)
|
||||
return oom_check(realloc(ptr, size));
|
||||
else
|
||||
return realloc(ptr, size);
|
||||
else {
|
||||
if (ptr)
|
||||
return realloc(ptr, size);
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
void *qemu_mallocz(size_t size)
|
||||
|
||||
Reference in New Issue
Block a user