From: Markus Armbruster Date: Tue, 15 Jan 2013 13:23:37 +0000 (+0100) Subject: w32: Make qemu_vfree() accept NULL like the POSIX implementation X-Git-Tag: qemu-xen-4.4.0-rc1~6^2~1400^2~3 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=94c8ff3a01d9bd1005f066a0ee3fe43c842a43b7;p=qemu-upstream-4.4-testing.git 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 Reviewed-by: Kevin Wolf Signed-off-by: Stefan Hajnoczi --- diff --git a/util/oslib-win32.c b/util/oslib-win32.c index e7e283e87..640194c0c 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 */