summaryrefslogtreecommitdiff
path: root/qemu-malloc.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-11 21:00:32 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-02-11 21:00:32 +0000
commitb59e96306e78412fc54e1d364b7f34c490ffb09c (patch)
treedc110bb739fcc7a3f8e38380ed49cc7c09a8d14c /qemu-malloc.c
parent40dc851420e17406bbbd0f68d32ab02e88e6cdb0 (diff)
downloadqemu-b59e96306e78412fc54e1d364b7f34c490ffb09c.tar.gz
qemu-b59e96306e78412fc54e1d364b7f34c490ffb09c.tar.bz2
qemu-b59e96306e78412fc54e1d364b7f34c490ffb09c.zip
Fix qemu_realloc() (Kevin Wolf)
For qemu_realloc with size == 0 a result of NULL is perfectly fine Signed-off-by: Kevin Wolf <kwolf@suse.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6615 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'qemu-malloc.c')
-rw-r--r--qemu-malloc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/qemu-malloc.c b/qemu-malloc.c
index e9e49cb8f2..676185786c 100644
--- a/qemu-malloc.c
+++ b/qemu-malloc.c
@@ -48,7 +48,10 @@ void *qemu_malloc(size_t size)
void *qemu_realloc(void *ptr, size_t size)
{
- return oom_check(realloc(ptr, size));
+ if (size)
+ return oom_check(realloc(ptr, size));
+ else
+ return realloc(ptr, size);
}
void *qemu_mallocz(size_t size)