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>
This commit is contained in:
Markus Armbruster 2013-01-15 14:23:37 +01:00 committed by Stefan Hajnoczi
parent f700f8e346
commit 94c8ff3a01

View File

@ -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 */