From patchwork Fri Mar 21 10:12:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunyan Liu X-Patchwork-Id: 332528 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 A24272C00B3 for ; Fri, 21 Mar 2014 21:16:14 +1100 (EST) Received: from localhost ([::1]:51721 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwUm-0001ti-ET for incoming@patchwork.ozlabs.org; Fri, 21 Mar 2014 06:16:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwR5-000624-BK for qemu-devel@nongnu.org; Fri, 21 Mar 2014 06:12:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQwQy-0007U0-Gu for qemu-devel@nongnu.org; Fri, 21 Mar 2014 06:12:23 -0400 Received: from victor.provo.novell.com ([137.65.250.26]:46095) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQwQy-0007Te-Bg for qemu-devel@nongnu.org; Fri, 21 Mar 2014 06:12:16 -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); Fri, 21 Mar 2014 04:12:04 -0600 From: Chunyan Liu To: qemu-devel@nongnu.org Date: Fri, 21 Mar 2014 18:12:21 +0800 Message-Id: <1395396763-26081-11-git-send-email-cyliu@suse.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1395396763-26081-1-git-send-email-cyliu@suse.com> References: <1395396763-26081-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 v23 10/32] 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. Signed-off-by: Chunyan Liu Reviewed-by: Eric Blake --- util/qemu-option.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/util/qemu-option.c b/util/qemu-option.c index 6c304b2..e9802f3 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -990,6 +990,10 @@ void qemu_opts_del(QemuOpts *opts) { QemuOpt *opt; + if (opts == NULL) { + return; + } + for (;;) { opt = QTAILQ_FIRST(&opts->head); if (opt == NULL)