qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/5] libqos: Allow calling guest_free on NULL pointe


From: Fam Zheng
Subject: [Qemu-devel] [PATCH 2/5] libqos: Allow calling guest_free on NULL pointer
Date: Fri, 24 Apr 2015 18:53:21 +0800

Signed-off-by: Fam Zheng <address@hidden>
---
 tests/libqos/malloc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c
index 67f3190..c15be89 100644
--- a/tests/libqos/malloc.c
+++ b/tests/libqos/malloc.c
@@ -283,6 +283,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);
-- 
1.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]