From patchwork Thu Jun 5 09:20:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 356253 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 03067140093 for ; Thu, 5 Jun 2014 19:27:37 +1000 (EST) Received: from localhost ([::1]:39432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsTxO-0003EQ-9e for incoming@patchwork.ozlabs.org; Thu, 05 Jun 2014 05:27:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsTrw-0003Qb-Rt for qemu-devel@nongnu.org; Thu, 05 Jun 2014 05:22:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsTrq-0008Bw-Pc for qemu-devel@nongnu.org; Thu, 05 Jun 2014 05:21:56 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:47744) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsTrq-0008BY-Jz for qemu-devel@nongnu.org; Thu, 05 Jun 2014 05:21:50 -0400 Received: from linux-cyliu.lab.bej.apac.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by victor.provo.novell.com with ESMTP (NOT encrypted); Thu, 05 Jun 2014 03:21:37 -0600 From: Chunyan Liu To: qemu-devel@nongnu.org Date: Thu, 5 Jun 2014 17:20:50 +0800 Message-Id: <1401960072-2363-12-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1401960072-2363-1-git-send-email-cyliu@suse.com> References: <1401960072-2363-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 v28 11/33] 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 Reviewed-by: Leandro Dorileo 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 6acfb0e..40e1ff3 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -1011,6 +1011,10 @@ void qemu_opts_del(QemuOpts *opts) { QemuOpt *opt; + if (opts == NULL) { + return; + } + for (;;) { opt = QTAILQ_FIRST(&opts->head); if (opt == NULL)