From nobody Sun Nov 24 07:56:05 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=swemel.ru ARC-Seal: i=1; a=rsa-sha256; t=1724681943; cv=none; d=zohomail.com; s=zohoarc; b=PkyLzaSxVYLaNulMeweQeH4lMmr6g+RLG6HJliNiRekJy7nKcAXDlx4VJm3GGmY9EmuP86edquetPx0zjEJzMqXN+Abt3SBNyJOy43XjzcTQM8CJcjqQjihuA3ksE/SSRzcbCrb4H+yk0z+6irB0gTWz9GzEF9lTK0ES5634jJg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724681943; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qxZun1D97KmfaFsb1w88H/aNJWFFa2IHFmfze+9EwuU=; b=eVybVGc/AqqKolKiAeSTvAiGRsVg9oqpokdgUJ9ENQM7gITZKFF9ZvIXzeC389eBAtqoJ95R7zd5xzH/fobEJVW8Qnj1n0ze2Gmp0zQmL+z5S0lFhqVnpAqbX2YtF8Pz5ZXK3SogEk2F/JwpruP68Uxvqa1cRFU7ThPSAO3QKxA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17246819431411001.3441376644205; Mon, 26 Aug 2024 07:19:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1siaXo-00026B-Ap; Mon, 26 Aug 2024 10:18:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1siaXl-000253-V0 for qemu-devel@nongnu.org; Mon, 26 Aug 2024 10:18:06 -0400 Received: from mx.swemel.ru ([95.143.211.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1siaXX-0002IO-K8 for qemu-devel@nongnu.org; Mon, 26 Aug 2024 10:18:05 -0400 From: Dmitry Frolov DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=swemel.ru; s=mail; t=1724681863; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=qxZun1D97KmfaFsb1w88H/aNJWFFa2IHFmfze+9EwuU=; b=o9sxlOX7SgzTYXAnJgpEbkUCJHnaf2wqbDNGv3BeZKflxD1zOtvg3euL8NxBzn+GltKWKO L9cyOJ3hFyaQ/9jp5hKiKMzKMDeDdcjMiHodMwNFY8+hmoFzj1+xDwn2larGKIunTPkMNV JOKczqj+KdqUSiYNxRCNN3ByxDa8q8w= To: rad@semihalf.com, peter.maydell@linaro.org Cc: sdl.qemu@linuxtesting.org, qemu-devel@nongnu.org, Dmitry Frolov Subject: [PATCH] hw/arm: fix memleak in sbsa-ref.c Date: Mon, 26 Aug 2024 17:16:21 +0300 Message-ID: <20240826141655.152179-2-frolov@swemel.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=95.143.211.150; envelope-from=frolov@swemel.ru; helo=mx.swemel.ru X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @swemel.ru) X-ZM-MESSAGEID: 1724681946921116600 Content-Type: text/plain; charset="utf-8" Memory, allocated by the first call of g_strdup_printf() is lost at the second call. Signed-off-by: Dmitry Frolov --- hw/arm/sbsa-ref.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index ae37a92301..10984fc339 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -164,23 +164,17 @@ static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineS= tate *sms, int idx) =20 static void sbsa_fdt_add_gic_node(SBSAMachineState *sms) { - char *nodename; - - nodename =3D g_strdup_printf("/intc"); - qemu_fdt_add_subnode(sms->fdt, nodename); - qemu_fdt_setprop_sized_cells(sms->fdt, nodename, "reg", + qemu_fdt_add_subnode(sms->fdt, "/intc"); + qemu_fdt_setprop_sized_cells(sms->fdt, "/intc", "reg", 2, sbsa_ref_memmap[SBSA_GIC_DIST].base, 2, sbsa_ref_memmap[SBSA_GIC_DIST].size, 2, sbsa_ref_memmap[SBSA_GIC_REDIST].base, 2, sbsa_ref_memmap[SBSA_GIC_REDIST].size); =20 - nodename =3D g_strdup_printf("/intc/its"); - qemu_fdt_add_subnode(sms->fdt, nodename); - qemu_fdt_setprop_sized_cells(sms->fdt, nodename, "reg", + qemu_fdt_add_subnode(sms->fdt, "/intc/its"); + qemu_fdt_setprop_sized_cells(sms->fdt, "/intc/its", "reg", 2, sbsa_ref_memmap[SBSA_GIC_ITS].base, 2, sbsa_ref_memmap[SBSA_GIC_ITS].size); - - g_free(nodename); } =20 /* --=20 2.43.0