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
commit322691a5c9f1c8531554148d47c078b5be590805 (patch)
treedc110bb739fcc7a3f8e38380ed49cc7c09a8d14c /qemu-malloc.c
parent9c22bc63129720e0c1fe6e910b0425923c123a31 (diff)
downloadqemu-322691a5c9f1c8531554148d47c078b5be590805.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)