From patchwork Tue Apr 29 09:10:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 343705 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 4C3A71400A6 for ; Tue, 29 Apr 2014 19:16:15 +1000 (EST) Received: from localhost ([::1]:48012 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf496-0007Cx-Ot for incoming@patchwork.ozlabs.org; Tue, 29 Apr 2014 05:16:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50488) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf44t-0000E6-8r for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:11:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wf44m-0003Pn-BB for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:11:51 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:42060) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wf44m-0003PJ-5r for qemu-devel@nongnu.org; Tue, 29 Apr 2014 05:11:44 -0400 Received: from linux-tt8j.lab.bej.apac.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by victor.provo.novell.com with ESMTP (NOT encrypted); Tue, 29 Apr 2014 03:11:39 -0600 From: Chunyan Liu To: qemu-devel@nongnu.org Date: Tue, 29 Apr 2014 17:10:35 +0800 Message-Id: <1398762656-26079-12-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1398762656-26079-1-git-send-email-cyliu@suse.com> References: <1398762656-26079-1-git-send-email-cyliu@suse.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 137.65.250.26 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 --- 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)