projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
20094ef
)
Abort on attempts to allocate zero bytes
author
malc
<av1474@comtv.ru>
Tue, 19 May 2009 18:26:42 +0000
(22:26 +0400)
committer
malc
<av1474@comtv.ru>
Tue, 19 May 2009 18:29:15 +0000
(22:29 +0400)
http://marc.info/?t=
124267873300015
&r=1&w=2
Signed-off-by: malc <av1474@comtv.ru>
qemu-malloc.c
patch
|
blob
|
history
diff --git
a/qemu-malloc.c
b/qemu-malloc.c
index 676185786c4e17e49f2213e7abd9df75f7088b65..5e9f47f518cb343707c26bb6339e90d0fa604dee 100644
(file)
--- a/
qemu-malloc.c
+++ b/
qemu-malloc.c
@@
-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)