From patchwork Mon Nov 27 17:08:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 747593 Delivered-To: patch@linaro.org Received: by 2002:a5d:6706:0:b0:32d:baff:b0ca with SMTP id o6csp3317904wru; Mon, 27 Nov 2023 09:11:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IH1bh1kKu9w3UXr2y6pnHG4/CVRMGxx3df6Cnw3y5/EUV4yuF7Kaj3Z7nrzBaMn1KzMJ9kS X-Received: by 2002:a05:620a:28ca:b0:77d:8f12:b88a with SMTP id l10-20020a05620a28ca00b0077d8f12b88amr9273292qkp.51.1701105113253; Mon, 27 Nov 2023 09:11:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701105113; cv=none; d=google.com; s=arc-20160816; b=RHLTvK5NLllGY7peUbWfidVjZQerWCVanytyiyaMMrBSHk1VHPEIh9RJyaodo64UVM tre0tQCCRb4mWxqyTl41cTG/sEnqQg0uw8MnNgIYQsY6jYV/u/Pfi8itRasi62oNbSQB 7STHfn6bOZht+zvFs6BvC8R75iGVJdH2X240TWYsZCWMVVSKJaBhc6DoOH5eGRqrfn4a wkjS5hcS+/dgmenOHVSZEsdvIuPkQeRWa5kDeKovlC3byF+nNX7L4MhnUuRJMmvdX+TP I0KsYp08A3ro1eFfUNM2WagT2ibPds67Rxv9CUP+qY+YWpNpXr+2TxXBtCst20w3soHp eALQ== 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:to:from :dkim-signature; bh=qtgG7nMoh/J0Wuwlj0UEmo0xDREAKAgqHzHLy2baaAs=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=uYW+w1GKGl0uPt1HJdLPCRKHu+t0bZeXr+xvlWXXBvO6Nr8+DrAdT4lhaaNTw3CYKK CA1nf1LsNSi91DL/Im9KRBZ4xzhQoFPZPcz5W3/Yf79NIDCSKrp1l4CJCQX93Q8sZugb rL3c14WdyLCvxDETBEtk3N6sznh95P2F9reUjP/rE8QfeyaiAKe7dxNg1rK3SiLtpvdE WaMa0l0Rr99eNdNtktzoy4yYw/pNHjIWyOnqJKJTtU7LYIK6uCEqJa+6N35lU6YKzyWB AMLYcKPOCEDoJaxXNQ58mqRyHuAEkNgP5u9cNCN/mSoRxj12saYa+lfIA9qTb8VzRubZ DuCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="tHpm/FIb"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pj16-20020a05620a1d9000b0077d72f44c61si9208315qkn.754.2023.11.27.09.11.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Nov 2023 09:11:53 -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; dkim=pass header.i=@linaro.org header.s=google header.b="tHpm/FIb"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7f63-0007SX-Bv; Mon, 27 Nov 2023 12:08:35 -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 1r7f60-0007Qp-KS for qemu-devel@nongnu.org; Mon, 27 Nov 2023 12:08:33 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7f5y-0004d8-Us for qemu-devel@nongnu.org; Mon, 27 Nov 2023 12:08:32 -0500 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-40b4734b975so7801185e9.2 for ; Mon, 27 Nov 2023 09:08:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701104909; x=1701709709; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qtgG7nMoh/J0Wuwlj0UEmo0xDREAKAgqHzHLy2baaAs=; b=tHpm/FIbMSk76asN/NPxAIqbBY2sTRA/+K4/ECCf4J23jaswiYsw4rTu69Sb1D+Kpn gsW5s8f7GpWOCyW+2Fcp9t22nj8rGRMSQnK7UkF2vPNNqu6UnIBOH+yqKUKHIFSHZpLY KaUdaomqc1rfU24ZBgePb1+RzXZUGq4huSem6Idq144a5ww/TNDxVrUzY5HkS/q2viGQ YdJrhdyIthl1cyoKSGDLrTC/pxhfRIbvDGplFk6+qDjlWytxZJttCAkKQBzMH8NrqLvh sYLyMJJCQFELiXC33RkzHJcsTAMDyAIk8JrEuB0C4hPw4N/DUUQfCoWiseGwpQXlMUFh 2vxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701104909; x=1701709709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qtgG7nMoh/J0Wuwlj0UEmo0xDREAKAgqHzHLy2baaAs=; b=cDuJERAMQFVRvVOu5PfySP7OLROYmX3ZPbb+subUysyz7csAEJh/UBJXYVYo1Ep7XV m3p8FpyUZ6r9jdgSm+5BYzpNDj/iE1gIxKTggTOyt8YDputg8wqPWhYdgxMyC59Pmxi0 zoAc0+dKoWi+P5Gv0OlteSv5nJi/V4isjSCc/cJK6ikensZkcjICnbO7kzPKRYXnFPoC x211iRgnCRyefWxSifql8vupXMB4RKR7sRZI3D1a9g8dOIGVfSrGLHRcUZTtfML7JMgb Qgms6WyLvsdLIihrPYUcbhUbVyRYZTnAfTWN3sA8Zx4hHPYtbv0A/nfPefPUeXuLabOJ pwGw== X-Gm-Message-State: AOJu0Yw94UBbIsXEL+n0hX52vfXUEr7hRnRgI+zcmbFvAkUJITT/xLBb kqTN5pxEclbLzeO3Ma0jhNG30mgctUr4bcyckec= X-Received: by 2002:a05:600c:19ca:b0:40b:367a:806 with SMTP id u10-20020a05600c19ca00b0040b367a0806mr8757538wmq.20.1701104909282; Mon, 27 Nov 2023 09:08:29 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id fl8-20020a05600c0b8800b004030e8ff964sm15353216wmb.34.2023.11.27.09.08.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 09:08:28 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 06/13] hw/virtio: Free VirtIOIOMMUPCI::vdev.reserved_regions[] on finalize() Date: Mon, 27 Nov 2023 17:08:16 +0000 Message-Id: <20231127170823.589863-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231127170823.589863-1-peter.maydell@linaro.org> References: <20231127170823.589863-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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, RCVD_IN_DNSWL_NONE=-0.0001, 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 8077b8e549 added: DEFINE_PROP_ARRAY("reserved-regions", VirtIOIOMMUPCI, vdev.nb_reserved_regions, vdev.reserved_regions, qdev_prop_reserved_region, ReservedRegion), but forgot to free the 'vdev.reserved_regions' array. Do it in the instance_finalize() handler. Cc: qemu-stable@nongnu.org Fixes: 8077b8e549 ("virtio-iommu-pci: Add array of Interval properties") # v5.1.0+ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Eric Auger Message-id: 20231121174051.63038-3-philmd@linaro.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/virtio/virtio-iommu-pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/virtio/virtio-iommu-pci.c b/hw/virtio/virtio-iommu-pci.c index 9459fbf6edf..cbdfe4c591c 100644 --- a/hw/virtio/virtio-iommu-pci.c +++ b/hw/virtio/virtio-iommu-pci.c @@ -95,10 +95,18 @@ static void virtio_iommu_pci_instance_init(Object *obj) TYPE_VIRTIO_IOMMU); } +static void virtio_iommu_pci_instance_finalize(Object *obj) +{ + VirtIOIOMMUPCI *dev = VIRTIO_IOMMU_PCI(obj); + + g_free(dev->vdev.prop_resv_regions); +} + static const VirtioPCIDeviceTypeInfo virtio_iommu_pci_info = { .generic_name = TYPE_VIRTIO_IOMMU_PCI, .instance_size = sizeof(VirtIOIOMMUPCI), .instance_init = virtio_iommu_pci_instance_init, + .instance_finalize = virtio_iommu_pci_instance_finalize, .class_init = virtio_iommu_pci_class_init, };