From nobody Tue Nov 4 23:53:47 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531730415596125.80051839332668; Mon, 16 Jul 2018 01:40:15 -0700 (PDT) Received: from localhost ([::1]:49765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez3G-0002IF-JK for importer@patchew.org; Mon, 16 Jul 2018 04:40:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40012) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fez1R-0001Dd-Bu for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fez1N-0004y6-49 for qemu-devel@nongnu.org; Mon, 16 Jul 2018 04:38:21 -0400 Received: from ozlabs.org ([203.11.71.1]:47541) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fez1M-0004sz-2s; Mon, 16 Jul 2018 04:38:16 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 41TcHm6TWbz9s3q; Mon, 16 Jul 2018 18:38:12 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1531730292; bh=WNLJS5aQiigD+sgv9EbP9GFZ0vPHGT1kxrWdRZ3hego=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cgRoCWGXlh4zrJgEVkAHmJb+g5Izi7Pn5gdCloWWEMbZWgbm5G/OhXWXO01kptsio yl5UpEYbraMYRZticvYvixbooYvDEFALYbeNFpUkvN/Dqb0/95prWaMbS68+c0D9yA hwU1++1eIWqdCPW1r8Bas7u24Fcz/bw9ESeCmCgE= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 16 Jul 2018 18:38:08 +1000 Message-Id: <20180716083809.17115-6-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180716083809.17115-1-david@gibson.dropbear.id.au> References: <20180716083809.17115-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 5/6] sam460ex: Correct use after free error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-ppc@nongnu.org, groug@kaod.org, David Gibson , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: BALATON Zoltan Commit 51b0d834c changed error handling to report file name in error message but forgot to move freeing it after usage. Noticed by Coverity. Fixes: CID 1394217 Reported-by: Paolo Bonzini Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- hw/ppc/sam460ex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index e2b7028843..0999efcc1e 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -269,11 +269,12 @@ static int sam460ex_load_device_tree(hwaddr addr, exit(1); } fdt =3D load_device_tree(filename, &fdt_size); - g_free(filename); if (!fdt) { error_report("Couldn't load dtb file `%s'", filename); + g_free(filename); exit(1); } + g_free(filename); =20 /* Manipulate device tree in memory. */ =20 --=20 2.17.1