From patchwork Tue Dec 12 12:18:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 753051 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp1868279wrs; Tue, 12 Dec 2023 04:21:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHVTS8pi2+ePX5VuQsP9+NubUyi8bQl7j3KEQOGrEsWloBtn6qyeskxt4voUpnJRq/v3WFy X-Received: by 2002:a9d:638a:0:b0:6d9:da51:b9f1 with SMTP id w10-20020a9d638a000000b006d9da51b9f1mr6082395otk.74.1702383708942; Tue, 12 Dec 2023 04:21:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702383708; cv=none; d=google.com; s=arc-20160816; b=dE1+B58DSKrbbpWI1vCOy3XOMG9n2THgeQOJUfGVMzs2jdEnPKqsMVdqdw6t/o42g4 sfNIQyie9Qfp3Oqs75C9Nu3Xn/fbNfPdmimUxZcuFaIiD5T/3dJF5JOovqfFoFzlp9VY ZTuW1Fvv5WBfpLqQdDLEZr2mw4iR0wojWa88Jd5ld5ArjYGpzsmCmk9zYiihEmEtLLLs XRdI0gtaOb1da6SELJOpMAbwiG1l0LCW8KK0bJU3qgPeaRqoxbeL38rknV+6Kjuauwei QaAtzYToo0+BSuOJPNrseGLBC9j8lPCLAu07X6tWBODTtwTLHtF3wGfvsOi/p/UMkP2R yqOQ== 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=QVsVIhkXJ5k2cGp2GaYl4TJPY+fNWnyuUIYWW4EhIwM=; fh=m04Zw7Rd3szriI+fwMSRTbsn9jEhMzlDh3fvULRyulY=; b=jWcgw8frcXckhCUudZZEjs5nnwuYW7oj78x7BRWG7Y+ikRO30J04Va4R63fC1C3meo FTaQu/jS1l8yLfQpwMxgLXaqcLgWjB2KDtmuPdt0Vqr0HTBUrEE1k77YL9lVFbaKZT/C Lv5/wCWjIRodlfAXA9tXqsQMzT5j5rIbTcxOMxMmiiCuFlxqIE6oU6vbFt2qIigmiqEe KOr562gCaEFZ8PFhIEOT8cw/prRkbqSdq15KnL9u6PFC402TDIph8oJSnCoXfGIpeidY 7lJ5LiCH0iMOHNsKooUHrL0m8I16jOUfECgREaIhMx4W0AmxTVT0wFNF2sxcvx/Crtto QJAw== 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 w8-20020a0cef88000000b0067a261b50fesi10058819qvr.320.2023.12.12.04.21.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Dec 2023 04:21:48 -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 1rD1kg-00076C-Q5; Tue, 12 Dec 2023 07:20:43 -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 1rD1kN-0006rK-LT; Tue, 12 Dec 2023 07:20:26 -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 1rD1kJ-0000V9-Rd; Tue, 12 Dec 2023 07:20:21 -0500 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 3054A3AF07; 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 EAAAF3B955; Tue, 12 Dec 2023 15:18:32 +0300 (MSK) Received: (nullmailer pid 1003456 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 19/31] hw/nvram/xlnx-efuse: Free XlnxEFuse::ro_bits[] array on finalize() Date: Tue, 12 Dec 2023 15:18:07 +0300 Message-Id: <20231212121831.1003318-19-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 68fbcc344e added: DEFINE_PROP_ARRAY("read-only", XlnxEFuse, ro_bits_cnt, ro_bits, qdev_prop_uint32, uint32_t), but forgot to free the 'ro_bits' array. Do it in the instance_finalize handler. Cc: qemu-stable@nongnu.org Fixes: 68fbcc344e ("hw/nvram: Introduce Xilinx eFuse QOM") # v6.2.0+ Signed-off-by: Philippe Mathieu-Daudé Message-id: 20231121174051.63038-5-philmd@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell (cherry picked from commit 49b3e28b7bdfe771150d05c4b5860aa7854a4232) Signed-off-by: Michael Tokarev diff --git a/hw/nvram/xlnx-efuse.c b/hw/nvram/xlnx-efuse.c index 655c40b8d1..f7b849f7de 100644 --- a/hw/nvram/xlnx-efuse.c +++ b/hw/nvram/xlnx-efuse.c @@ -224,6 +224,13 @@ static void efuse_realize(DeviceState *dev, Error **errp) } } +static void efuse_finalize(Object *obj) +{ + XlnxEFuse *s = XLNX_EFUSE(obj); + + g_free(s->ro_bits); +} + static void efuse_prop_set_drive(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { @@ -280,6 +287,7 @@ static const TypeInfo efuse_info = { .name = TYPE_XLNX_EFUSE, .parent = TYPE_DEVICE, .instance_size = sizeof(XlnxEFuse), + .instance_finalize = efuse_finalize, .class_init = efuse_class_init, };