diff options
author | Markus Armbruster <armbru@redhat.com> | 2009-12-14 10:48:05 +0100 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2010-02-23 22:36:19 +0100 |
commit | f8b0953bd5e34f87458108051a485246d40adadc (patch) | |
tree | 5403a7ef779ac783ec9ccb4c722258d16145d8a0 /qemu-malloc.c | |
parent | e1c247d26cc15dbdf3f99836c0b16a6c91128cf2 (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.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/qemu-malloc.c b/qemu-malloc.c index 5d9e34d69..6cdc5deb7 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) |