From patchwork Tue Apr 29 09:08:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 343756 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 562241400DE for ; Tue, 29 Apr 2014 19:46:03 +1000 (EST) Received: from localhost ([::1]:48386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf4bx-0007iF-AJ for incoming@patchwork.ozlabs.org; Tue, 29 Apr 2014 05:46:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf4NI-0004EE-W2 for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:31:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wf4N8-0001hj-N8 for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:30:52 -0400 Received: from [203.192.156.9] (port=19686 helo=linux-tt8j.site) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf4N8-0001gA-BN for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:30:42 -0400 Received: by linux-tt8j.site (Postfix, from userid 0) id 7A32B83AC0; Tue, 29 Apr 2014 17:08:42 +0800 (CST) From: Chunyan Liu To: qemu-devel@nongnu.org Date: Tue, 29 Apr 2014 17:08:20 +0800 Message-Id: <1398762521-25733-12-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1398762521-25733-1-git-send-email-cyliu@suse.com> References: <1398762521-25733-1-git-send-email-cyliu@suse.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.192.156.9 Cc: stefanha@redhat.com Subject: [Qemu-devel] [PATCH V26 11/32] QemuOpts: check NULL input for qemu_opts_del 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 To simplify later using of qemu_opts_del, accept NULL input. Reviewed-by: Stefan Hajnoczi Reviewed-by: Eric Blake Signed-off-by: Chunyan Liu Reviewed-by: Leandro Dorileo --- util/qemu-option.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/qemu-option.c b/util/qemu-option.c index 4de99b3..2667e16 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -1010,6 +1010,10 @@ void qemu_opts_del(QemuOpts *opts) { QemuOpt *opt; + if (opts == NULL) { + return; + } + for (;;) { opt = QTAILQ_FIRST(&opts->head); if (opt == NULL)