aboutsummaryrefslogtreecommitdiff
path: root/qemu-malloc.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2009-12-14 10:48:05 +0100
committerAurelien Jarno <aurelien@aurel32.net>2010-02-23 22:36:19 +0100
commitf8b0953bd5e34f87458108051a485246d40adadc (patch)
tree5403a7ef779ac783ec9ccb4c722258d16145d8a0 /qemu-malloc.c
parente1c247d26cc15dbdf3f99836c0b16a6c91128cf2 (diff)
Simplify qemu_realloc()
No functional change. Bonus: looks just like qemu_malloc() now. Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'qemu-malloc.c')
-rw-r--r--qemu-malloc.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/qemu-malloc.c b/qemu-malloc.c
index 5d9e34d69d..6cdc5deb78 100644
--- a/qemu-malloc.c
+++ b/qemu-malloc.c
@@ -61,12 +61,10 @@ void *qemu_malloc(size_t size)
void *qemu_realloc(void *ptr, size_t size)
{
- if (size) {
- return oom_check(realloc(ptr, size));
- } else if (allow_zero_malloc()) {
- return oom_check(realloc(ptr, size ? size : 1));
+ if (!size && !allow_zero_malloc()) {
+ abort();
}
- abort();
+ return oom_check(realloc(ptr, size ? size : 1));
}
void *qemu_mallocz(size_t size)