From patchwork Wed Feb 2 15:34:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 81487 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by ozlabs.org (Postfix) with ESMTP id 4E3C4B70E3 for ; Thu, 3 Feb 2011 03:41:01 +1100 (EST) Received: from localhost ([127.0.0.1]:56139 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pkfg9-0005ZF-CF for incoming@patchwork.ozlabs.org; Wed, 02 Feb 2011 11:35:37 -0500 Received: from [140.186.70.92] (port=48793 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pkej8-0000HL-Mo for qemu-devel@nongnu.org; Wed, 02 Feb 2011 10:34:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pkej7-0003zF-E8 for qemu-devel@nongnu.org; Wed, 02 Feb 2011 10:34:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40749) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pkej7-0003zA-4V for qemu-devel@nongnu.org; Wed, 02 Feb 2011 10:34:37 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p12FYa2V004660 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Feb 2011 10:34:36 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p12FYZKM008436; Wed, 2 Feb 2011 10:34:35 -0500 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id AF5CF18D3E9; Wed, 2 Feb 2011 17:34:34 +0200 (IST) Date: Wed, 2 Feb 2011 17:34:34 +0200 From: Gleb Natapov To: qemu-devel@nongnu.org Message-ID: <20110202153434.GP14984@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: armbru@redhat.com Subject: [Qemu-devel] [PATCH] do not pass NULL to strdup. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Also use qemu_strdup() instead of strdup() in bootindex code. Signed-off-by: Gleb Natapov --- Should go to stable too. -- Gleb. diff --git a/vl.c b/vl.c index 655617f..ed2cdfa 100644 --- a/vl.c +++ b/vl.c @@ -738,7 +738,7 @@ void add_boot_device_path(int32_t bootindex, DeviceState *dev, node = qemu_mallocz(sizeof(FWBootEntry)); node->bootindex = bootindex; - node->suffix = strdup(suffix); + node->suffix = suffix ? qemu_strdup(suffix) : NULL; node->dev = dev; QTAILQ_FOREACH(i, &fw_boot_order, link) { @@ -785,7 +785,7 @@ char *get_boot_devices_list(uint32_t *size) } else if (devpath) { bootpath = devpath; } else { - bootpath = strdup(i->suffix); + bootpath = qemu_strdup(i->suffix); assert(bootpath); }