From patchwork Tue Dec 12 12:18:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 753053 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp1869530wrs; Tue, 12 Dec 2023 04:24:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IG7kwV1wWdQuzJ0bJHehRT8jGp3X4WdOogyNw5if7TL+5fyCwOuuFPhxfuoENqr+w1lB34s X-Received: by 2002:a05:6808:6507:b0:3ba:ad9:9ed7 with SMTP id fm7-20020a056808650700b003ba0ad99ed7mr3792839oib.109.1702383865895; Tue, 12 Dec 2023 04:24:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702383865; cv=none; d=google.com; s=arc-20160816; b=zGXCDwXyxIC3lKBgUM2o4sbAPl51ESo0JZwVGBiziQRq+ITrh/AIq/UKH2tW84jvdy 8Mpaar71jvpnqBTTZ5XAkunBmRWOWBF8wtu1QiAtwgZsSysAYv48YWXLUsmNJjp+CdTN hL9bhxxSsFQ6ygSBVXFMKXpS2LpLzFNO+gVSSgI1RiQ0u+j1oZyCDE3SCdw7/jbO5QtE AErW20BYg4jaWUZnWp7pPv4BTC/U9W1zJFqI90p4aHkhSpiq/S9TxhKMsA+9rDIBmhT6 ArSReO/i8wX4vt6umQMgK2A01FujVhHoa3NkO5xveZ+1uhSSogqLBeOewq6pKlPeuP5C WzxQ== 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=aJ75w3113P6By9X7EcFWwaUcJl1tsDgxMGAy9W1Vq0n07qtZVnUmvqW+ALQztghs1u W5kM0qBmZMHyICrEHpHzjiZqMM4tT5SliAqyv0jaOYuPnm8JcceVQ/MWVBanucB/afFu 1t7zPXKTZ4zBp0gnmwMJaoFD/vGKi6WD5GEB5MJBnW1PQL25W+zDyG/bvvFTsaPeM3Dw IkXg1xujH9rao3NVxMVfxsc9nD6msaw0kU0UGRpNfNED0TuH4JlKrjC2Hr11vT22fOty K+bef61IOa3PyB1hafIwcpJq17Z6d1r94QWswX6YjX4gICn64uPiuEvMvAQOVEcWbZ2Q SpkQ== 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 v11-20020a05620a440b00b0077f75c6421esi4830008qkp.637.2023.12.12.04.24.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Dec 2023 04:24:25 -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 1rD1ke-0006zM-UO; Tue, 12 Dec 2023 07:20:42 -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 1rD1kK-0006kq-Pl; Tue, 12 Dec 2023 07:20:24 -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 1rD1kI-0000Uo-LX; Tue, 12 Dec 2023 07:20:20 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 1F00B3AF06; Tue, 12 Dec 2023 15:18:50 +0300 (MSK) Received: from tls.msk.ru (mjt.wg.tls.msk.ru [192.168.177.130]) by tsrv.corpit.ru (Postfix) with SMTP id D96C33B954; Tue, 12 Dec 2023 15:18:32 +0300 (MSK) Received: (nullmailer pid 1003453 invoked by uid 1000); Tue, 12 Dec 2023 12:18:31 -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-8.1.4 18/31] hw/misc/mps2-scc: Free MPS2SCC::oscclk[] array on finalize() Date: Tue, 12 Dec 2023 15:18:06 +0300 Message-Id: <20231212121831.1003318-18-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, };