aboutsummaryrefslogtreecommitdiff
path: root/util/oslib-win32.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2013-01-15 14:23:37 +0100
committerStefan Hajnoczi <stefanha@redhat.com>2013-01-15 16:46:50 +0100
commit94c8ff3a01d9bd1005f066a0ee3fe43c842a43b7 (patch)
treeeee7fc8521fcc0a5209b29a3e1236a20abe89709 /util/oslib-win32.c
parentf700f8e3463b5d61383121fa6f79564d6132b10d (diff)
w32: Make qemu_vfree() accept NULL like the POSIX implementation
On POSIX, qemu_vfree() accepts NULL, because it's merely wrapper around free(). As far as I can tell, the Windows implementation doesn't. Breeds bugs that bite only under Windows. Make the Windows implementation behave like the POSIX implementation. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'util/oslib-win32.c')
-rw-r--r--util/oslib-win32.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index e7e283e875..640194c0cf 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -71,7 +71,9 @@ void *qemu_vmalloc(size_t size)
void qemu_vfree(void *ptr)
{
trace_qemu_vfree(ptr);
- VirtualFree(ptr, 0, MEM_RELEASE);
+ if (ptr) {
+ VirtualFree(ptr, 0, MEM_RELEASE);
+ }
}
/* FIXME: add proper locking */