From: Fam Zheng Date: Fri, 24 Apr 2015 11:35:17 +0000 (+0800) Subject: libqos: Allow calling guest_free on NULL pointer X-Git-Tag: v2.4.0-rc0~43^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=28452758c405e16d9890c44d6031d44233e8cb38;p=thirdparty%2Fqemu.git libqos: Allow calling guest_free on NULL pointer Signed-off-by: Fam Zheng Reviewed-by: John Snow Signed-off-by: Paolo Bonzini --- diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c index 827613005a7..82b9df537a8 100644 --- a/tests/libqos/malloc.c +++ b/tests/libqos/malloc.c @@ -285,6 +285,9 @@ uint64_t guest_alloc(QGuestAllocator *allocator, size_t size) void guest_free(QGuestAllocator *allocator, uint64_t addr) { + if (!addr) { + return; + } mlist_free(allocator, addr); if (allocator->opts & ALLOC_PARANOID) { mlist_check(allocator);