From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlbtO-0006ls-NX for qemu-devel@nongnu.org; Fri, 24 Apr 2015 07:35:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlbtN-0005z9-UK for qemu-devel@nongnu.org; Fri, 24 Apr 2015 07:35:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55312) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlbtN-0005z3-Ee for qemu-devel@nongnu.org; Fri, 24 Apr 2015 07:35:33 -0400 From: Fam Zheng Date: Fri, 24 Apr 2015 19:35:17 +0800 Message-Id: <1429875320-410-3-git-send-email-famz@redhat.com> In-Reply-To: <1429875320-410-1-git-send-email-famz@redhat.com> References: <1429875320-410-1-git-send-email-famz@redhat.com> Subject: [Qemu-devel] [PATCH v2 2/5] libqos: Allow calling guest_free on NULL pointer List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, afaerber@suse.de, stefanha@redhat.com Signed-off-by: Fam Zheng --- 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