From patchwork Fri Apr 24 10:53:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 464174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 32010140187 for ; Fri, 24 Apr 2015 21:01:08 +1000 (AEST) Received: from localhost ([::1]:44154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlbM2-0001hy-GC for incoming@patchwork.ozlabs.org; Fri, 24 Apr 2015 07:01:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34677) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlbLd-000154-3K for qemu-devel@nongnu.org; Fri, 24 Apr 2015 07:00:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YlbLY-0003Tl-Vy for qemu-devel@nongnu.org; Fri, 24 Apr 2015 07:00:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YlbLY-0003Tc-JG for qemu-devel@nongnu.org; Fri, 24 Apr 2015 07:00:36 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 82FE6A0B7D; Fri, 24 Apr 2015 10:53:34 +0000 (UTC) Received: from ad.nay.redhat.com (dhcp-14-137.nay.redhat.com [10.66.14.137]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3OArQj8032469; Fri, 24 Apr 2015 06:53:32 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Fri, 24 Apr 2015 18:53:21 +0800 Message-Id: <1429872804-27321-3-git-send-email-famz@redhat.com> In-Reply-To: <1429872804-27321-1-git-send-email-famz@redhat.com> References: <1429872804-27321-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, pbonzini@redhat.com, afaerber@suse.de, stefanha@redhat.com Subject: [Qemu-devel] [PATCH 2/5] libqos: Allow calling guest_free on NULL pointer X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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);