summaryrefslogtreecommitdiffstats
path: root/tests/libqos
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2015-04-24 19:35:17 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2015-06-17 16:03:47 +0200
commit28452758c405e16d9890c44d6031d44233e8cb38 (patch)
treee503cf594e49f3bc455aba883ffd6a3e333353cb /tests/libqos
parentebe7d8b166c59b029521f8d95db011e5e0fc649d (diff)
downloadhqemu-28452758c405e16d9890c44d6031d44233e8cb38.zip
hqemu-28452758c405e16d9890c44d6031d44233e8cb38.tar.gz
libqos: Allow calling guest_free on NULL pointer
Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests/libqos')
-rw-r--r--tests/libqos/malloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c
index 8276130..82b9df5 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);
OpenPOWER on IntegriCloud