From nobody Mon Nov 25 09:43:41 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1715261340; cv=none; d=zohomail.com; s=zohoarc; b=ajRUTJw38QFL+z/6pv/p38LN22bqrpVJr7hG6siM9/lohKJBqF4In4GWRPiKhJV4LxgixU4Fclu9VdK4vJf8QaigP/ny2M49Dicg09bZ8SEA0amdN78NgvqU8p67ojPeh7e4mBScorU/XmvWgE0nngd+0hFrSxffsRuNST6rna0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715261340; 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=ES82ewI1NIHI1vn/pNjCtvapE45ezZFMf+6qtK8J3mk=; b=fm3q+BVnNU5rBu9EUvpMH+qXSsEE9ZSpjT39iS5Y50MYb87a0zMPf5/V8Me4YZ65aQbxKaHzPahDCpIN21ENNbG8U61M9uAE9PPb6SduGnhK3oZfJboyJwEVX8Xt69NRXNKKocj5KV87QVGCew1iln6u53gqk/uXtXH9ImSyFs8= 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=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1715261340536742.1266862691909; Thu, 9 May 2024 06:29:00 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s53ok-00057u-P1; Thu, 09 May 2024 09:28:14 -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 1s53oj-00057i-Vv; Thu, 09 May 2024 09:28:14 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s53oi-0000ZO-G4; Thu, 09 May 2024 09:28:13 -0400 Received: by mail-pf1-x431.google.com with SMTP id d2e1a72fcca58-6f45020ac2cso754141b3a.0; Thu, 09 May 2024 06:28:11 -0700 (PDT) Received: from rs.ip (115-189-84-241.mobile.spark.co.nz. [115.189.84.241]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2ae0dd5sm1265247b3a.135.2024.05.09.06.28.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 06:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715261290; x=1715866090; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ES82ewI1NIHI1vn/pNjCtvapE45ezZFMf+6qtK8J3mk=; b=JXowYWv9rYJyWvZ6Na4C+oZoKK/WYltv2Wz+mYyIoAOZHNjF8LW0FTTOgj4KbrPcl1 BE+pnSkmyCEAPo8tyxKjr+WbevCCZOBX0CfzABsK7PacrbgiBlDMYlVC4wZ2cKbzW5V3 tRh68IBJHU85eHzCUROxYEKcKIm28E+y6VCMAoFBTbwW1G8tfl4IgJSHZmj0OugkBNXL N8ImNqHRvVNCQ4yK4pXQldBfXh6cFLhG+S1T9lF2VpaOuOAeBsyqT+Ab32Jhelesh0D2 N3kUkIZ/IlKNqYQy22mIcS+w3bFFTQTxnctg9e9sBs8qCPaKCArfHIfYRA0U8U+FKFUa pJuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715261290; x=1715866090; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ES82ewI1NIHI1vn/pNjCtvapE45ezZFMf+6qtK8J3mk=; b=L2h/uSUK1WgLZfZ0iS8SNuWhy8DM2aso8aYD3rF4MdGFaugq6auPaNSEr7XvAcnMx8 2TpNNJnFC0dnGpz408gT1O3ueQPm3K+x4tXEyDM5tMHw3c1ku1oM81X0ziQD7oxcuNxd VB47FA7/znp/y6a6FxSjEK55OhL5M1QId4G5BJd+ehhx9P9dQ/XtIIabpPD7yNKSKk1f yLeiJdY5xkDVcMUgT9ju5KGeIiz8SVclRCdVSVwo8u8pAxe12rIA2H44DUXvjqWQF5ah f33vL1bDpwMpc9AHhbqocubfH+Vem94h/SD1/4cvJicrc5fpQfSa65OCg9tIzfZwKU7a fHYQ== X-Gm-Message-State: AOJu0Yw8veP86jCXYs2QGBV1agL9FP1V+isWhJPSPJIU7TPM6Gfs9r+t NchGQdGHmG7qUB72sfXAFOJM2oVHd/Ok8tuhs1HjMW3gft78/DLBbHtWwg== X-Google-Smtp-Source: AGHT+IGrdaOqmIij8VL+i4U/wIL2ZrZvQb3tcT4nag7867Rb38x0hFeCFp3MpdrTTcgrxTKOojEmFA== X-Received: by 2002:a05:6a00:1387:b0:6ea:d7b6:f4b4 with SMTP id d2e1a72fcca58-6f49c292487mr6799321b3a.21.1715261290010; Thu, 09 May 2024 06:28:10 -0700 (PDT) From: "R.Samarasekara" To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, gaosong@loongson.cn, raj3sr@gmail.com, "R.Samarasekara" Subject: [PATCH] hw/loongarch/virt.c: Fixes memory leak in ramName during loop iterations Date: Fri, 10 May 2024 01:28:02 +1200 Message-Id: <20240509132802.247147-1-rsamarnz@gmail.com> X-Mailer: git-send-email 2.40.1 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=2607:f8b0:4864:20::431; envelope-from=rsamarnz@gmail.com; helo=mail-pf1-x431.google.com 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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 @gmail.com) X-ZM-MESSAGEID: 1715261349279100003 Content-Type: text/plain; charset="utf-8" This patch fixes a memory leak in the ramName variable within the hw/loongarch/virt.c file. The leak occurs due to repeated calls to g_strdup_printf within a loop, causing memory allocated for ramName on previous iterations to be unfreed. Signed-off-by: R.Samarasekara --- hw/loongarch/virt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index c0999878df..1fe02f8501 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -954,6 +954,7 @@ static void loongarch_init(MachineState *machine) fdt_add_memory_node(machine, phyAddr, numa_info[i].node_mem, i); offset +=3D numa_info[i].node_mem; phyAddr +=3D numa_info[i].node_mem; + g_free(ramName); } =20 /* initialize device memory address space */ --=20 2.40.1