From patchwork Wed Dec 13 13:00:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 753521 Delivered-To: patch@linaro.org Received: by 2002:adf:ff85:0:b0:336:3f68:820c with SMTP id j5csp182285wrr; Wed, 13 Dec 2023 05:05:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IHxeDSy5VLqKjCswV0BmNxnqUaSlkF0Go+xQkgf6pCbYfP8JiBbYCZf1NZ5WzsgEE3x+t2K X-Received: by 2002:a05:6214:9c6:b0:67a:a721:e118 with SMTP id dp6-20020a05621409c600b0067aa721e118mr8081444qvb.69.1702472746228; Wed, 13 Dec 2023 05:05:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702472746; cv=none; d=google.com; s=arc-20160816; b=TUP/2mtOqBvQ3jDY5ehKkOrXmmSWEOC9SGrUFDSy1wXCzRtVc3wyYwCLGkQiPOZIxc 6QYC9631+VWOLBc7Y9CcL/N83QGJwqudQUGG/134NhiZhuGVzE9uU1W3vF7/PNPJARyu QZ+DUKphi/KiewiO+WqmnimH7rlEuGRLz83syH5OqFOC28ng8IJZsHH597FcWRKQsesW IrBfSKCFRdUA/feK9X+5pYycbbVuUf6ZSn4WxygBWkJsli71n6UkoQNCRxU9XzMVR0Fe nkU2D2Pom4hdsSd5H28S5syViA0w6tPU3Az5yGY7uYgCLoPKkQ9BZ/DEgMnKollVIw7V e42A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=dFRWswkCk1rwH5QyWUG1sIeSPJbYvSHERQCXqz+munE=; fh=m04Zw7Rd3szriI+fwMSRTbsn9jEhMzlDh3fvULRyulY=; b=PCSZirTv5yRPBZI2VHyXMksIdAVIFvtFnn21W4lmPpyNMj2eclUGSehYa1jdpyIYS3 gzNZddkYfWb3YBWNa4akGVZMrSOeXbIUOWfmvD+SqUnRZ8xmO7KFIQDDy9CT/gNmcBti KXeBb2yvS6ONLyH1hABT3TDIR+Fn2joeZouf0+yeHtEiHeg+OrxlChjNKKJ1F2xqJEu6 HCzuQvG0wBL6bkgbWAwLWlxpJTxWKG/894L/Rtzk28fLATOiBxArTreRf81NnqpLUZkJ P12cGfKfXD1qQpXwOuuIIlDqXxkR8vmr7oY3RoyXj2c8pK/A/TUReGkwLVBkDm0TUfsx kHEA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x14-20020a0ceb8e000000b0067eb0003116si2392916qvo.162.2023.12.13.05.05.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Dec 2023 05:05:46 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDOt0-0000og-HG; Wed, 13 Dec 2023 08:02:58 -0500 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 1rDOrd-00087t-Th; Wed, 13 Dec 2023 08:01:30 -0500 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rDOrZ-00070W-Lu; Wed, 13 Dec 2023 08:01:23 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 65B393B43D; Wed, 13 Dec 2023 16:01:01 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id 0B0613C8CE; Wed, 13 Dec 2023 16:00:42 +0300 (MSK) Received: (nullmailer pid 1024724 invoked by uid 1000); Wed, 13 Dec 2023 13:00:41 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Peter Maydell , Michael Tokarev Subject: [Stable-7.2.8 10/24] hw/misc/mps2-scc: Free MPS2SCC::oscclk[] array on finalize() Date: Wed, 13 Dec 2023 16:00:19 +0300 Message-Id: <20231213130041.1024630-10-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Commit 0be6bfac62 ("qdev: Implement variable length array properties") added the DEFINE_PROP_ARRAY() macro with the following comment: * It is the responsibility of the device deinit code to free the * @_arrayfield memory. Commit 4fb013afcc added: DEFINE_PROP_ARRAY("oscclk", MPS2SCC, num_oscclk, oscclk_reset, qdev_prop_uint32, uint32_t), but forgot to free the 'oscclk_reset' array. Do it in the instance_finalize() handler. Cc: qemu-stable@nongnu.org Fixes: 4fb013afcc ("hw/misc/mps2-scc: Support configurable number of OSCCLK values") # v6.0.0+ Signed-off-by: Philippe Mathieu-Daudé Message-id: 20231121174051.63038-4-philmd@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell (cherry picked from commit 896dd6ff7b9f2575f1a908a07f26a70b58d8b675) Signed-off-by: Michael Tokarev diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c index b3b42a792c..fe5034db14 100644 --- a/hw/misc/mps2-scc.c +++ b/hw/misc/mps2-scc.c @@ -329,6 +329,13 @@ static void mps2_scc_realize(DeviceState *dev, Error **errp) s->oscclk = g_new0(uint32_t, s->num_oscclk); } +static void mps2_scc_finalize(Object *obj) +{ + MPS2SCC *s = MPS2_SCC(obj); + + g_free(s->oscclk_reset); +} + static const VMStateDescription mps2_scc_vmstate = { .name = "mps2-scc", .version_id = 3, @@ -385,6 +392,7 @@ static const TypeInfo mps2_scc_info = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(MPS2SCC), .instance_init = mps2_scc_init, + .instance_finalize = mps2_scc_finalize, .class_init = mps2_scc_class_init, };