diff options
-rw-r--r-- | qemu-malloc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/qemu-malloc.c b/qemu-malloc.c index 6cdc5deb78..1b33e04601 100644 --- a/qemu-malloc.c +++ b/qemu-malloc.c @@ -69,10 +69,10 @@ void *qemu_realloc(void *ptr, size_t size) void *qemu_mallocz(size_t size) { - void *ptr; - ptr = qemu_malloc(size); - memset(ptr, 0, size); - return ptr; + if (!size && !allow_zero_malloc()) { + abort(); + } + return oom_check(calloc(1, size ? size : 1)); } char *qemu_strdup(const char *str) |