From nobody Thu Nov 28 11:36:35 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; arc=pass (i=1 dmarc=pass fromdomain=outlook.com); dmarc=pass(p=none dis=none) header.from=outlook.com ARC-Seal: i=2; a=rsa-sha256; t=1692930843; cv=pass; d=zohomail.com; s=zohoarc; b=J+RU+U9JpAms1CGw3DInzb9rUHINiMEQ+SvAcqaH5ejD0PoM6Aau79lJ3RnguGFEftYKmSE+IjU4sKLuBLnJEQ00cOZbhXluXNZZGClYwySTCuzO3dSkL5Asmk4/4xWafhVi0m6C3vgSR0iO2z6CaE3QyAhezM292evyBcbysEA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692930843; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7+8SZMnIWVynuduy4NTpdNCFWUxetALixt7hCAfwXH4=; b=f9DIKwVLJSz9wBTOLmGmyLxe5aTLkt1/DV0qoZR3T0SLi1OpxsSKzvp0Dh9tgx0+E0y4x+/t2solAYsziJlwELyCK1BIaKuqw5tA4ZL6X8avxv6lgEqTG5+1QesACPHhBFBMjI/9r9W8MNMux2xjroroSu6aDVeDza6jh5wyZEQ= ARC-Authentication-Results: i=2; 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; arc=pass (i=1 dmarc=pass fromdomain=outlook.com); 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 1692930843084428.3068738278246; Thu, 24 Aug 2023 19:34:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qZMdP-0001Dt-AI; Thu, 24 Aug 2023 22:33:15 -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 1qZMdN-0001De-DK for qemu-devel@nongnu.org; Thu, 24 Aug 2023 22:33:13 -0400 Received: from mail-mw2nam12olkn20817.outbound.protection.outlook.com ([2a01:111:f400:fe5a::817] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qZMdL-0001X6-6y for qemu-devel@nongnu.org; Thu, 24 Aug 2023 22:33:13 -0400 Received: from SA1PR11MB6760.namprd11.prod.outlook.com (2603:10b6:806:25f::14) by SJ2PR11MB8449.namprd11.prod.outlook.com (2603:10b6:a03:56f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.27; Fri, 25 Aug 2023 02:32:34 +0000 Received: from SA1PR11MB6760.namprd11.prod.outlook.com ([fe80::df85:2db:d56b:38bf]) by SA1PR11MB6760.namprd11.prod.outlook.com ([fe80::df85:2db:d56b:38bf%5]) with mapi id 15.20.6699.027; Fri, 25 Aug 2023 02:32:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ole/bw7N/zkgqF97WLKUwnNMH5T30iAET55f2MZNmbAdqGWRtM/DBR9D7u6STNWjB7rmb5l/6F2SDlIlNU6skhSdJ0uX1Iz/pfitP1TIVJXVO4iqrqEaRhn0DGOEbmJxPXTH+ivZbORcyletRV1EDv23wzU+R9Dz57vq9vZcWw5u9qsGcIk8Vk4ymjKeKFq5JtVJeYinua1eJXO2bOA/afPx8G4KZpBN4m02GU2goYNFlE59P3ZpmEU2jfNxERImxcxzd5K9y9acqGHXqVYW+JxN42R5CEpCrLjmPuClQoKMv2jSzi3QUNHWpxxq5hiL04EAu4bGgDcC4MtqffZlCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7+8SZMnIWVynuduy4NTpdNCFWUxetALixt7hCAfwXH4=; b=H848wte8efeASZCS1vVzImj/OJ+fUn/NabCRC5K5Z+XOWW7wEFFJzcxjFDTUdajig3ay3cyCDorskmsnieh6ai0eyA8S7usnEb0efakxxcj3xT9+aMW2zmO4mqtsrbmokCQTdi89drOihZBS4dZk7vhupfSAuTQAak9EOF5Jyky+cpptheMVNPdDhD+/t8J4ebQHwBinv9bG5Fv+CGu1sE5u0CyF4aXKsE3kfHZeZQoVt7rymwPaZikIs3nNHeigWnKGGWE7cc8UU9z6CsHiq20TqMwD5maSav0dRJuoSdCt4Px9STKhyIgHNMrQ+uwpgAxtLruXlCcRP9s5LY+UUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7+8SZMnIWVynuduy4NTpdNCFWUxetALixt7hCAfwXH4=; b=BzzAhkta1ypht5Pr6Par/u18ez3xkGWtiT8u0gTUEHHhQWceJTjnZXe7r4VT5FFqOmQoKzbEVxERFuCoerH1wEVzGWm95P31hDkGosmbHuNYRLbB2LZT5gpxpvmuPt7jvS1xFfwE8EZy59IAWxcQb4GmCvjw/Pm7atBeD9xsMqkeghBaYpcnwmzmcmGcCCblbmPWtL85smYYI9gJGVyoC8jNQIFOgBLRjrWPhd/DlGkNZS0nbY8V5etrt0RDwuZ6lPP97Oi8RZozdH1zwYRuiLRzzK98CfBYb3C21aij8eOgpEaW9nMbukmBBLtMeRtU0TMkt/BXgSzWKHZk2+oXxA== From: alloc.young@outlook.com To: yong.huang@smartx.com Cc: mjt@tls.msk.ru, qemu-devel@nongnu.org, "alloc.young" Subject: [PATCH v2 1/2] softmmu: Fix dirtylimit memory leak Date: Fri, 25 Aug 2023 10:31:20 +0800 Message-ID: X-Mailer: git-send-email 2.39.3 In-Reply-To: References: Content-Transfer-Encoding: quoted-printable X-TMN: [BugqierZPbBCfGHXsIptqA2KDNEWoivvGo3e83nWrXk=] X-ClientProxiedBy: SI2P153CA0033.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::21) To SA1PR11MB6760.namprd11.prod.outlook.com (2603:10b6:806:25f::14) X-Microsoft-Original-Message-ID: <2e796c56b3ec535817ded15577e9e0077c20f6aa.1692925847.git.alloc.young@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA1PR11MB6760:EE_|SJ2PR11MB8449:EE_ X-MS-Office365-Filtering-Correlation-Id: f16f2d38-a7db-4932-649a-08dba51389e9 X-MS-Exchange-SLBlob-MailProps: ScCmN3RHayGFyzKqG2j+JWu7TdfJHtreszRPvNKDxsAQXCPywoArShX/ID2wnzbypwrIbm46+wvhNanMGBRELyzisZ+hBQ2CvFhw9f1pQqD3kN6eiC5pTaClCBdoTFBDDZqtrHQ3uB3Wua9vHu9kzQkw2qoqlILfqulWdh1k/0bRjwGUwxozLPPQ+EGMVHnYD1Yzbbl8T8UMPzqtrF4I9reIqealgXEdh8wjgu7nCN5PMYRMHF2SUeqNMZdCQIbZjPCOcpLPufTmX6QcUc6g3vHrQMR4cUKIE0UEiWA+xpit0xNVcYC+MCoLdD0/Rbuz6EJcz5g6BbygeqlSEWnvwsuU3hZorG8Jc4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AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?GY0Y4hI4/PsELA7DbwCrrQhDrOsNw1HkuASGKTvuaGc26qTw5kYRMX5TDWPr?= =?us-ascii?Q?QxS/UXWCJZqPMiYffOS+z8wZAKGqzAPDWwvd/TDTuBPwP3SczGdxhgfAyXkx?= =?us-ascii?Q?V06xykJhQ5s91t7LUK8hncC77OLghVPXnEl1YXsLyVRhykTOYcW4kjB52TAp?= =?us-ascii?Q?6BCDEeOzthCk6ozb496PSaLvmGRa2oHK0UWrTiQt0V0jsa0Br2S+wIRIlWfC?= =?us-ascii?Q?1uWynCn0rpQY10vyUli7JZ6mzhK5wxl22Il/R5/3BFZcifibHw1wYkhL+08N?= =?us-ascii?Q?NMrvbJnZo1EjEFx4jg4HC0zmJSQAyWVBd3Qbe6wgvXvjn17wPQ0j4EBL8z7k?= =?us-ascii?Q?DRd7swsh53XvoP3dPLLbJA34bndbru7M2pi36gMaTNNFryEsvbxRz1YjDt5k?= =?us-ascii?Q?wmROLWw2T+ufZZAitKpCJZdfVfoC23rpGc5txF5TzFJxbLzLtMEygMknM96g?= =?us-ascii?Q?C6mQ9RBdzpqEZUfMiMbEmMmFEgW7w/f0dn2ZGHjk9YyQVy8n1cSy0BNBIjTc?= =?us-ascii?Q?IoIrPIaYIOPiC4xWuUZTTD1PEKe+mLM2y7zngxOyMobHybNwMWL1yiR0sc7J?= =?us-ascii?Q?glwbfdAaE3Ksu3+lZ/Ei9YJ8G0FEdRhy7zoq5UVoDUuwV3ueY78aDHvvAh7j?= =?us-ascii?Q?+exIFtiVNyUCif86RC7fKfcEjqOJ0cBQs70UzUvZVxMWtKL97v8UnFhECez5?= =?us-ascii?Q?FPyD/S/RBDsDMeMBDJb3SPmlm3ndec48oM9UwqaRTonP9HSDwozjBqJvCgDg?= =?us-ascii?Q?GJaFTOCZtd/8rdadx4dmrF3tbnRVPyIxf+7NAtuoc104HyMa9NIevNTm60me?= =?us-ascii?Q?WKmktgrK/LrHOgDwhK7AeBlOjZaa8+oOAltE12NTML5ENa8lZct4BTzOH4Ik?= =?us-ascii?Q?c6Pf4QsWHrqaOxSzUwtscRx6V30SnDEQ/4K5in0l5PeuWxkITWpo+YactCCj?= =?us-ascii?Q?O7K6QDQ58lFRDKs3z88nf6z2IgJaRqPrplQcjwMpBivYKyMArH256JXD70mu?= =?us-ascii?Q?SaDI5a0XrRVqtfB+Cr5GpokaxvD/kmO3tedDNYkz/i+3GzlQ6trzn9U9ucp3?= =?us-ascii?Q?h38tj21yo7FaaXp34L2SZO2iv3g/7F5gBRwE4LrOx4LiGbw3//BBAYniI3YC?= =?us-ascii?Q?vZVCdgLu79YNoSYJ+CRwtkZt5I8LQLEIf6FC1n8qsKBATROwDLeITp0i/a6b?= =?us-ascii?Q?YmN+sbovqIq+YnK9EVieFSV35S/zXOwUWzcw9foARWyHudTRIC98S72pYJs?= =?us-ascii?Q?=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f16f2d38-a7db-4932-649a-08dba51389e9 X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB6760.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2023 02:32:34.3274 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB8449 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=2a01:111:f400:fe5a::817; envelope-from=alloc.young@outlook.com; helo=NAM12-MW2-obe.outbound.protection.outlook.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, SPF_HELO_PASS=-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 @outlook.com) X-ZM-MESSAGEID: 1692930844862100003 Content-Type: text/plain; charset="utf-8" From: "alloc.young" Fix memory leak in hmp_info_vcpu_dirty_limit,use g_autoptr to handle memory deallocation. Signed-off-by: alloc.young --- softmmu/dirtylimit.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c index 3c275ee55b..e3ff53b8fc 100644 --- a/softmmu/dirtylimit.c +++ b/softmmu/dirtylimit.c @@ -653,7 +653,8 @@ struct DirtyLimitInfoList *qmp_query_vcpu_dirty_limit(E= rror **errp) =20 void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict) { - DirtyLimitInfoList *limit, *head, *info =3D NULL; + DirtyLimitInfoList *info; + g_autoptr(DirtyLimitInfoList) head =3D NULL; Error *err =3D NULL; =20 if (!dirtylimit_in_service()) { @@ -661,20 +662,17 @@ void hmp_info_vcpu_dirty_limit(Monitor *mon, const QD= ict *qdict) return; } =20 - info =3D qmp_query_vcpu_dirty_limit(&err); + head =3D qmp_query_vcpu_dirty_limit(&err); if (err) { hmp_handle_error(mon, err); return; } =20 - head =3D info; - for (limit =3D head; limit !=3D NULL; limit =3D limit->next) { + for (info =3D head; info !=3D NULL; info =3D info->next) { monitor_printf(mon, "vcpu[%"PRIi64"], limit rate %"PRIi64 " (MB/s)= ," " current rate %"PRIi64 " (MB/s)\n", - limit->value->cpu_index, - limit->value->limit_rate, - limit->value->current_rate); + info->value->cpu_index, + info->value->limit_rate, + info->value->current_rate); } - - g_free(info); } --=20 2.39.3