Commit 322691a5c9f1c8531554148d47c078b5be590805
1 parent
9c22bc63
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
Showing
1 changed file
with
4 additions
and
1 deletions
qemu-malloc.c
@@ -48,7 +48,10 @@ void *qemu_malloc(size_t size) | @@ -48,7 +48,10 @@ void *qemu_malloc(size_t size) | ||
48 | 48 | ||
49 | void *qemu_realloc(void *ptr, size_t size) | 49 | void *qemu_realloc(void *ptr, size_t size) |
50 | { | 50 | { |
51 | - return oom_check(realloc(ptr, size)); | 51 | + if (size) |
52 | + return oom_check(realloc(ptr, size)); | ||
53 | + else | ||
54 | + return realloc(ptr, size); | ||
52 | } | 55 | } |
53 | 56 | ||
54 | void *qemu_mallocz(size_t size) | 57 | void *qemu_mallocz(size_t size) |