From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282758; cv=none; d=zohomail.com; s=zohoarc; b=ZOKk6zVolyWWZtU5w7TcbjraYku7Tg+Sb61tboexyl6eJKgrp9Ldx/gcsOnKZW4gvxI/Izn9BH6RqFZXu4EqmyXZQmDCY85DWuvx/yisEqGaupM2LNa3xDRITF8zi0CYQEYCxYDJx99v1rpU/Egjrh+/4oET4Dixx8A6k9+o8q0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282758; h=Content-Type:Content-Transfer-Encoding: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=gYx2rMIhMi8XR+ATsp6v1uHRT2sW9OqJNpr6+PakXfk=; b=hBCy/Fno7Weq1q34/5kJJ3Hjsl6j1hrwDRV3p8FjLh4EB0v01L7YUmt2h51no6ixCfLfPtj6un1XxE4yYQzp10mKLN5CgwbYWujSlXMG54stN9cUzFJtZCxVls6FEsQLIHVcOa7Bp7dRKV6ZP33eGweliXYSB7UYntoMCjPkvj0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1638282758717309.5078525352841; Tue, 30 Nov 2021 06:32:38 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-51-cHLi9suSP9q_Xd0m8VMcIQ-1; Tue, 30 Nov 2021 09:32:36 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5B1F210B7440; Tue, 30 Nov 2021 14:32:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B8BF176608; Tue, 30 Nov 2021 14:32:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AB2281809C89; Tue, 30 Nov 2021 14:32:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEWOkp022134 for ; Tue, 30 Nov 2021 09:32:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2639360C0F; Tue, 30 Nov 2021 14:32:24 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8879E60C4A for ; Tue, 30 Nov 2021 14:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282757; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gYx2rMIhMi8XR+ATsp6v1uHRT2sW9OqJNpr6+PakXfk=; b=gGz3DeacGxxuxmbEDuIzCmM/2JuI+1LL98B8wIXaHseVNpFGVKa9+2K/0OeVCLbos55LSS f9K6oE8daMlOP8WFWRrFYb74w8N0lnVPD1fHv04wokiL9brYIZ2YO8jcm0QifO9nwj26PR okxjXWd40u3wRRCEWmEU7URFpVLf87k= X-MC-Unique: cHLi9suSP9q_Xd0m8VMcIQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/23] virDomainNetDefParseXML: Automatically free GHashTable Date: Tue, 30 Nov 2021 15:31:45 +0100 Message-Id: <48ae681fc70f67c4f9f8ad7effaf1ed5e7adbd9e.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282760095100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/conf/domain_conf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f88405ab02..25e504a99a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10244,7 +10244,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, xmlNodePtr vlan_node =3D NULL; xmlNodePtr bandwidth_node =3D NULL; xmlNodePtr tmpNode; - GHashTable *filterparams =3D NULL; + g_autoptr(GHashTable) filterparams =3D NULL; virDomainActualNetDef *actual =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) virDomainChrSourceReconnectDef reconnect =3D {0}; @@ -10431,7 +10431,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, if ((filterref_node =3D virXPathNode("./filterref", ctxt))) { filter =3D virXMLPropString(filterref_node, "filter"); - virHashFree(filterparams); filterparams =3D virNWFilterParseParamAttributes(filterref_node); } @@ -10960,7 +10959,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, cleanup: virDomainActualNetDefFree(actual); - virHashFree(filterparams); return def; error: --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282762; cv=none; d=zohomail.com; s=zohoarc; b=GPDxZQhJF8HlJltMT/DcD9Yai24xx3YwGBGSdoEsKzVwBUcektZFGCl0nFXUDnp2u8aBxhq+nVj0qWexbeXci/kPw9/TN/PwRzW2M6n3jhjRgunm2Xz6ENWS0VWoiFRwKLg8MQu9qdSCzNsZwpdWH5K3MYsje4EcSF5B6z6Twj0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282762; h=Content-Type:Content-Transfer-Encoding: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=MsBfcKEpz9v6vspiW0wVoCTIXkUiOxslCVBFqBhJ6Qc=; b=lJjOeeMxehH5JGjf1l+wy29xJBD6RXNS0gUIEbl0yBUCqcpmlZ3FghKcov8/DKLqcgKAVIfXk+ixl4eQpbzobwXi+ME2G6RO0+b27je3H3B1nPI2CEWkatvkWfMVs2LdsEee20fV6DhZV3uxxjsNh+Vt1Q6+AvaIdO/Z97mOFbo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638282762149317.44656684438974; Tue, 30 Nov 2021 06:32:42 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-594--UBhBveTOfWvFRJ6YZNE7A-1; Tue, 30 Nov 2021 09:32:36 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9BFF31927801; Tue, 30 Nov 2021 14:32:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 765A879456; Tue, 30 Nov 2021 14:32:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 407F34A7C9; Tue, 30 Nov 2021 14:32:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEWPId022153 for ; Tue, 30 Nov 2021 09:32:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4E44D60CC9; Tue, 30 Nov 2021 14:32:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id A11C360C81 for ; Tue, 30 Nov 2021 14:32:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282761; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MsBfcKEpz9v6vspiW0wVoCTIXkUiOxslCVBFqBhJ6Qc=; b=WoXt/nZCdQ+7orkjITDpmTkqB/8Kb6yg0bbYbtnerpIZjghCSJPX9gJCqfnF5kUatGoolx uBqn7iYca/TM0rX8A2+3hrVubiMCIOwcHulKs8Ed1xdKJjOEqpamjUXh9wOwnechfNtZn9 e66HOS2vN1ZWP2OtX1X+7RO/da2g5hM= X-MC-Unique: -UBhBveTOfWvFRJ6YZNE7A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/23] virDomainDeviceValidateAliasImpl: Automatically free GHashTable and remove cleanup Date: Tue, 30 Nov 2021 15:31:46 +0100 Message-Id: <6e26af02778bd5b869785dd3bb9ac4ac27fc9396.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282762762100001 Content-Type: text/plain; charset="utf-8" After the conversion to g_autofree, the cleanup label is no longer needed. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/conf/domain_validate.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 80401cf8c7..a4271f1247 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1360,28 +1360,23 @@ static int virDomainDeviceValidateAliasImpl(const virDomainDef *def, virDomainDeviceDef *dev) { - GHashTable *aliases =3D NULL; + g_autoptr(GHashTable) aliases =3D NULL; virDomainDeviceInfo *info =3D virDomainDeviceGetInfo(dev); - int ret =3D -1; if (!info || !info->alias) return 0; if (virDomainDefValidateAliases(def, &aliases) < 0) - goto cleanup; + return -1; if (virHashLookup(aliases, info->alias)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("non unique alias detected: %s"), info->alias); - goto cleanup; + return -1; } - ret =3D 0; - cleanup: - - virHashFree(aliases); - return ret; + return 0; } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282769; cv=none; d=zohomail.com; s=zohoarc; b=kVL6FCvnSwpzJULGXKdNOr7Sj8tMChJQqU+Ms7B07BXUPEALij85tMy5KMhJ73GvmJw4jFD3czIkzg0O/4t5oXnKRISAsXPjob4hO/kr9/5wZcWsEV8fLyjGJH7njYTJoDCJA1gR/2hK0aiHuyMuAINHAchGrnpEsHBF67tYZ6s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282769; h=Content-Type:Content-Transfer-Encoding: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=m8zmvf4ULi6dGNwJIWDfBUkHqfPbSA8xtqhgdGxz/xQ=; b=j7KyIJpnEKeryzqAlP3q+XcfzEjMsUO6jpsUWpZqbHnmwhhSVtra7g4BRUMaS1wfIVT6qkwWkD6th3ebykTCZhC6tM0NnP/37WPbDtl+wvigOICCmetSORrdQANeRGAmLfefjPDHPqzI3lNko7EO2tC+EgOwpA+BdlmFTU2WWpo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 163828276918823.182179348929026; Tue, 30 Nov 2021 06:32:49 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-117-frJhcYRUMTi9QsDvFY99vw-1; Tue, 30 Nov 2021 09:32:46 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EFBBE1927810; Tue, 30 Nov 2021 14:32:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D3B2B45D6B; Tue, 30 Nov 2021 14:32:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A4BEF4A705; Tue, 30 Nov 2021 14:32:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEWQGR022188 for ; Tue, 30 Nov 2021 09:32:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6602060CA1; Tue, 30 Nov 2021 14:32:26 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDFA160C81 for ; Tue, 30 Nov 2021 14:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282768; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=m8zmvf4ULi6dGNwJIWDfBUkHqfPbSA8xtqhgdGxz/xQ=; b=CaTgPLCVQdlwfVVCbUh30+E2IRfwTKELU9JuIpFrSw8K5+fpQdY2hYY6dIEmO8dNd/4HlG 7USN8ufRB+4TSVNEGRPywfl/ewhDNAIFw3456lhx4O9y9ptiogMb8+u0QXQzQ6n+CG2Lbw PeHnSKab8di0EmS1J41UhlHBhoZJqQc= X-MC-Unique: frJhcYRUMTi9QsDvFY99vw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/23] libxlLoggerNew: Avoid virHashFree by rearranging code Date: Tue, 30 Nov 2021 15:31:47 +0100 Message-Id: <2797345719e07522bcf1813616ec17b4021ac9a9.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282770141100001 Content-Type: text/plain; charset="utf-8" Allocate the hash table only after the log file is opened so that we don't need to deallocate it on failure. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/libxl/libxl_logger.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libxl/libxl_logger.c b/src/libxl/libxl_logger.c index f7b5c8ee16..4692578124 100644 --- a/src/libxl/libxl_logger.c +++ b/src/libxl/libxl_logger.c @@ -149,14 +149,13 @@ libxlLoggerNew(const char *logDir, virLogPriority min= Level) break; } logger.logDir =3D logDir; - logger.files =3D virHashNew(libxlLoggerFileFree); path =3D g_strdup_printf("%s/libxl-driver.log", logDir); - if ((logger.defaultLogFile =3D fopen(path, "a")) =3D=3D NULL) { - virHashFree(logger.files); + if ((logger.defaultLogFile =3D fopen(path, "a")) =3D=3D NULL) return NULL; - } + + logger.files =3D virHashNew(libxlLoggerFileFree); return XTL_NEW_LOGGER(libvirt, logger); } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282772; cv=none; d=zohomail.com; s=zohoarc; b=Q/B2YtZz7Tt4mF9E7ICEeuwDPUnkd+bWVX4Sc8Kwh9w+iuqUrBrw+WkriSs8n/i8762nc3n/hgGTbzE6opY5Ib+BG2ZqKXlCX2d6rl6LJmd25okdOVJRpCmUQmGbxAMK/HrBj7+aLsS63EUtPwPEEm+GdQb3swOeO52aUN0OeK8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282772; h=Content-Type:Content-Transfer-Encoding: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=IDNdP+4ex+2DrBt9rkw/sLfkMAC9eWyG/Z7hG01iuhM=; b=bwqvrM1GKKni37UjbqOC3D2VRvTdf4iv/9c7Q3rN8jodansCySI8e4kZrrpmiDDC23wEiCQOrqi6HCwMBvCWrMWb4hLjwC6trJOQCiFPcm6BDPm3dgQV2bPTHxjlDR2tyT82OR/JAQ9nz0kO7b5U/FDhZXqD/xE3rxe656DZl7w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638282772936576.7651194383841; Tue, 30 Nov 2021 06:32:52 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-454-h_UDmfVCM6ataKRmXdCqiA-1; Tue, 30 Nov 2021 09:32:50 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B72DC86A065; Tue, 30 Nov 2021 14:32:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99BF75D9C0; Tue, 30 Nov 2021 14:32:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6E0551809CB7; Tue, 30 Nov 2021 14:32:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEWRRN022234 for ; Tue, 30 Nov 2021 09:32:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8C71F60C4A; Tue, 30 Nov 2021 14:32:27 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA1E060CA1 for ; Tue, 30 Nov 2021 14:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282771; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=IDNdP+4ex+2DrBt9rkw/sLfkMAC9eWyG/Z7hG01iuhM=; b=exANzVbiW4/137M9IUuH9H35Hw/iDRjuC8bxjOCqkGMnV7cvjISUtfyrtvNar52plXmgG7 H76mB3OzYAcv0/LRrheovVLrBHZtH8G8siTuHZ5haBQAiONkvxbOJne3GMxI27MxqxSulv IXSzIQowiNPBLZ0N9VgYpkGgD3giOLM= X-MC-Unique: h_UDmfVCM6ataKRmXdCqiA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/23] virNWFilterDoInstantiate: Automatically free temporary GHashTable Date: Tue, 30 Nov 2021 15:31:48 +0100 Message-Id: <3f5854edfadef8bbc87fa7e72236e87edec33799.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282773719100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/nwfilter/nwfilter_gentech_driver.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter= _gentech_driver.c index ecba16d55c..55c7571ea5 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -493,8 +493,7 @@ virNWFilterDoInstantiate(virNWFilterTechDriver *techdri= ver, virNWFilterVarValue *lv; const char *learning; bool reportIP =3D false; - - GHashTable *missing_vars =3D virHashNew(virNWFilterVarValueHashFree); + g_autoptr(GHashTable) missing_vars =3D virHashNew(virNWFilterVarValueH= ashFree); memset(&inst, 0, sizeof(inst)); @@ -593,7 +592,6 @@ virNWFilterDoInstantiate(virNWFilterTechDriver *techdri= ver, error: virNWFilterInstReset(&inst); - virHashFree(missing_vars); return rc; --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282798; cv=none; d=zohomail.com; s=zohoarc; b=RUFmwcNNAbCPNR0jeZaUC6zDASWN09UnK4rOBuiX4vYU/RJdNMYoAWWdKCZjJVkqQS1egsrrHFvHLi6T2sUnzojuXVVWayYYtyrQGmw0gfZtLm/FdDPlXO3612DosH308DLh4UrER23C7F/iPH1v51YPj2mnqyrgVAYPe9dHv2M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282798; h=Content-Type:Content-Transfer-Encoding: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=8qaG4gaBQk9wHdKn8ewdPhoTEf0PIC4Bql5HXzoj/as=; b=E1Oo5OH2LuYpMFpnMCA+HhKTLEUZUrYIbFnuav1q3O/BNrH2Vv1aUeZ0kGpQm1VQC3hZ0OjKGQgvQwMPLIdSpgCsV4F11DINxE4RRrKMSD8m2g+zVfA3kcZDwC1eCBXVrETMG8aIdEg2X60BcKYG7WS6oU5VmYG0jb3XxaYe5u8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1638282798305252.2313962236634; Tue, 30 Nov 2021 06:33:18 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-481-deRrC0KbNjm5RI-dMYnKkg-1; Tue, 30 Nov 2021 09:32:46 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 060D7101AFC2; Tue, 30 Nov 2021 14:32:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D9CA97945C; Tue, 30 Nov 2021 14:32:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A885C4A706; Tue, 30 Nov 2021 14:32:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEWWSG022331 for ; Tue, 30 Nov 2021 09:32:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id DD92E60C81; Tue, 30 Nov 2021 14:32:32 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4AE3460C13 for ; Tue, 30 Nov 2021 14:32:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282797; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8qaG4gaBQk9wHdKn8ewdPhoTEf0PIC4Bql5HXzoj/as=; b=FbklmyNmOwbXWcGvwMM23Yp4EMVmG4rqeEDCGgX1vurNkKWsPO+KvgtbcQlyrG+eyrOTf6 UEyM5Q/fFbkIjH6776QGzMilYBSFPIqZUMJMHy3u8GiOs3RP8zZNQAZM5O7F14Q2upoz+Z 8MfMABhq1O75n4v0qjhk2udQszXJWNc= X-MC-Unique: deRrC0KbNjm5RI-dMYnKkg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/23] virNWFilterBuildAll: Automatically free temporary GHashTable Date: Tue, 30 Nov 2021 15:31:49 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282799731100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/nwfilter/nwfilter_gentech_driver.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter= _gentech_driver.c index 55c7571ea5..ea1f4f4092 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -979,7 +979,8 @@ virNWFilterBuildAll(virNWFilterDriverState *driver, VIR_DEBUG("Build all filters newFilters=3D%d", newFilters); if (newFilters) { - data.skipInterfaces =3D virHashNew(NULL); + g_autoptr(GHashTable) skipInterfaces =3D virHashNew(NULL); + data.skipInterfaces =3D skipInterfaces; data.step =3D STEP_APPLY_NEW; if (virNWFilterBindingObjListForEach(driver->bindings, @@ -998,8 +999,6 @@ virNWFilterBuildAll(virNWFilterDriverState *driver, virNWFilterBuildIter, &data); } - - virHashFree(data.skipInterfaces); } else { data.step =3D STEP_APPLY_CURRENT; if (virNWFilterBindingObjListForEach(driver->bindings, --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282784; cv=none; d=zohomail.com; s=zohoarc; b=CBFXZDx4MwobQ2PXKMka53gKhPqCGtjTCzLbmgrugBQZAPfjJuBClSBz+CBpm39Pidsrrp8+/L16ntF8fjH7OGCIw3GKQW8VuyWUCj4DqU33vPnOkcBtNkdQuKGmlG4/Hh/J5rgMhYO+6FEcq17aG3I96HjhyhkHu9E0a0O7aUs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282784; h=Content-Type:Content-Transfer-Encoding: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=Vz0lym1TsfAkzLA02a81scUIer6c/1hQZN1DsT3xp7s=; b=MFXbOaUl2BEx4kFJOFxKQwf7wDhlaUt254gLQkmqTOkF3zuf/bqeWooYfLD9yXW/djOtUJdoVRWWucusExwn2mZWahVy3gBgQEd5GP79LxzPKV0GMGVUZtKYzIwqrDynQFifXierbcQDrQsSQghm+wnNOvFI9IN4HabP7hIGy0s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638282784797701.4420465130407; Tue, 30 Nov 2021 06:33:04 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-128-lZkKVhi7OwKiY2W_Xctqkg-1; Tue, 30 Nov 2021 09:32:58 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 41E731927802; Tue, 30 Nov 2021 14:32:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 224BD60CC9; Tue, 30 Nov 2021 14:32:52 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CBD284A70D; Tue, 30 Nov 2021 14:32:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEWYFb022359 for ; Tue, 30 Nov 2021 09:32:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 113C660FDD; Tue, 30 Nov 2021 14:32:34 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 576F860C13 for ; Tue, 30 Nov 2021 14:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282782; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Vz0lym1TsfAkzLA02a81scUIer6c/1hQZN1DsT3xp7s=; b=Dd+di2CAxLYme9zf4eEQ7wcQTr+we6l9VjJpQueZiFwgPVMFO2c+2MS3LEsLMsVKdoi+ow tlUoda5j2NfS3TnPEtP3LgANa7yJ/lXX4wbhHR+qJmkxd3srXP6gcbbxTVVIbDI1XCP0ll H0MvoaNy/us2OuOPcUe8zMBJLsrMVL4= X-MC-Unique: lZkKVhi7OwKiY2W_Xctqkg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/23] qemuDomainUpdateMemoryDeviceInfo: Automatically free temporary GHashTable Date: Tue, 30 Nov 2021 15:31:50 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282786142100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/qemu/qemu_domain.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1f45b30975..3dfc79f61e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8198,7 +8198,7 @@ qemuDomainUpdateMemoryDeviceInfo(virQEMUDriver *drive= r, int asyncJob) { qemuDomainObjPrivate *priv =3D vm->privateData; - GHashTable *meminfo =3D NULL; + g_autoptr(GHashTable) meminfo =3D NULL; int rc; size_t i; @@ -8210,10 +8210,8 @@ qemuDomainUpdateMemoryDeviceInfo(virQEMUDriver *driv= er, rc =3D qemuMonitorGetMemoryDeviceInfo(priv->mon, &meminfo); - if (qemuDomainObjExitMonitor(driver, vm) < 0) { - virHashFree(meminfo); + if (qemuDomainObjExitMonitor(driver, vm) < 0) return -1; - } if (rc < 0) return -1; @@ -8247,7 +8245,6 @@ qemuDomainUpdateMemoryDeviceInfo(virQEMUDriver *drive= r, } } - virHashFree(meminfo); return 0; } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282791; cv=none; d=zohomail.com; s=zohoarc; b=V7IBjaZ7+0wAZKONLLlt+rA4mJEpDuPVRQahMIar6+UjGgXXf46QqM8sHMfb74LPZaFHqe9YX0vki9XRUzwOn9HbcBv+rY6lwMp7px7S7vl5YcspJsF8SUPzPPgPL9g7aPzROl+d/e07Vow+OKdIZOG/tTAUVejygPRFMzsylIU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282791; h=Content-Type:Content-Transfer-Encoding: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=AWCL7LP2iTqSDVo2iHTrFd6z7tLa256yJqWQMLqKFso=; b=ffbX9t+5geuEPO/Wv8aYDYNAuM/pqfjSVkOWES+5a1RQb5V9MmN36C+DubV2j11Bwyu8UZ5L2+P0Ogi46W7u2aXD5j6rWPHEHceacsN6pP647JDG9fmWayHMuxYfKUk48po1h/G1nn2+BNwx4cn7kieDyAsGIIXF0l522dJKLXw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 163828279159240.47225899574755; Tue, 30 Nov 2021 06:33:11 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-186-60VZMzaoNYWKyRpvzNOHSA-1; Tue, 30 Nov 2021 09:33:08 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DF63083DD23; Tue, 30 Nov 2021 14:33:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C075D7945B; Tue, 30 Nov 2021 14:33:03 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9312D4A70F; Tue, 30 Nov 2021 14:33:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEX2xI022684 for ; Tue, 30 Nov 2021 09:33:02 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7EC8250306; Tue, 30 Nov 2021 14:33:02 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6DDE60FDD for ; Tue, 30 Nov 2021 14:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282790; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=AWCL7LP2iTqSDVo2iHTrFd6z7tLa256yJqWQMLqKFso=; b=ASQUkf2p911yxjhmCnQPoIgpeI600l1HGej7S8F3L2i5RJQU4IfStWHILqrHkiJZFy0fVO 0zX3u1VTjtUDHBaabA5XcPyfv/0HGKn+1/vXVzVOAVfVCqPsb+8e8rViaYV+jMawTNgO49 tdHdEf/TYqnRK5QecgIi4OtQ0JYzoBg= X-MC-Unique: 60VZMzaoNYWKyRpvzNOHSA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/23] qemuDomainBlocksStatsGather: Automatically free GHashTable and refactor cleanup Date: Tue, 30 Nov 2021 15:31:51 +0100 Message-Id: <528021af98adf97cca34e559afee062d6be7c077.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282792832100001 Content-Type: text/plain; charset="utf-8" No need for the cleanup section once we switch to g_autoptr. Signed-off-by: Peter Krempa Reviewed-by: Martin Kletzander --- src/qemu/qemu_driver.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4e680bc0a7..5330a1d3b7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9975,24 +9975,23 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, qemuDomainObjPrivate *priv =3D vm->privateData; bool blockdev =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); virDomainDiskDef *disk =3D NULL; - GHashTable *blockstats =3D NULL; + g_autoptr(GHashTable) blockstats =3D NULL; qemuBlockStats *stats; size_t i; int nstats; int rc =3D 0; const char *entryname =3D NULL; - int ret =3D -1; if (*path) { if (!(disk =3D virDomainDiskByName(vm->def, path, false))) { virReportError(VIR_ERR_INVALID_ARG, _("invalid path: %s"), pat= h); - goto cleanup; + return -1; } if (virStorageSourceGetActualType(disk->src) =3D=3D VIR_STORAGE_TY= PE_VHOST_USER) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("block stats are not supported for vhostuser = disk")); - goto cleanup; + return -1; } if (blockdev && QEMU_DOMAIN_DISK_PRIVATE(disk)->qomName) { @@ -10001,7 +10000,7 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, if (!disk->info.alias) { virReportError(VIR_ERR_INTERNAL_ERROR, _("missing disk device alias name for %s"),= disk->dst); - goto cleanup; + return -1; } entryname =3D disk->info.alias; @@ -10019,7 +10018,7 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, } if (qemuDomainObjExitMonitor(driver, vm) < 0 || nstats < 0 || rc < 0) - goto cleanup; + return -1; *retstats =3D g_new0(qemuBlockStats, 1); @@ -10027,7 +10026,7 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, if (!(stats =3D virHashLookup(blockstats, entryname))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find statistics for device '%s'"), en= tryname); - goto cleanup; + return -1; } **retstats =3D *stats; @@ -10063,18 +10062,14 @@ qemuDomainBlocksStatsGather(virQEMUDriver *driver, if (!(stats =3D virHashLookup(blockstats, entryname))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find statistics for device '%s'")= , entryname); - goto cleanup; + return -1; } qemuDomainBlockStatsGatherTotals(stats, *retstats); } } - ret =3D nstats; - - cleanup: - virHashFree(blockstats); - return ret; + return nstats; } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282806; cv=none; d=zohomail.com; s=zohoarc; b=MT22wWhnDbXeSsoMFBbxzq+EUiKoitumukSVDxXh3piKGMrA+Y1P+xipAJU+Ugh35meHFfQTfiVHQhOq0yQWKRezXFVO3N1lYxV+lgPqe9O9zL77QvLXnE/F9tHPMiQV1pT60WcTXHn8U6rzLFh4iMuummJzIkZw8dcV3g/IGFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282806; h=Content-Type:Content-Transfer-Encoding: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=PWL+Ovpwi/w64vKluF8Ta4YJ/VK3tZR/TXzcmn58m5o=; b=dhJNxPlDf0882XYCr2nD4BMhpEKrRyThxvkVCnaYxplm6P1gxi23EPUzbPx8lMAEq7JZ83lNflXnAoi4vLFnnmNv/ZuVU4jUxaIhO7AskTLRet7ur0F05RC3ZvIzdoVzbXToW5Pbf3GiqXGZgWdS5CdiL228QEHRnQ4NY81AaRU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1638282806541741.7759749403721; Tue, 30 Nov 2021 06:33:26 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-291-f3gaWIDOPH6k2RGklFP43Q-1; Tue, 30 Nov 2021 09:33:22 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 09F0E92506; Tue, 30 Nov 2021 14:33:10 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DED451972D; Tue, 30 Nov 2021 14:33:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B2AF84A705; Tue, 30 Nov 2021 14:33:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEX8o3022769 for ; Tue, 30 Nov 2021 09:33:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id A2D8318831; Tue, 30 Nov 2021 14:33:08 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBFE260CA1 for ; Tue, 30 Nov 2021 14:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282805; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=PWL+Ovpwi/w64vKluF8Ta4YJ/VK3tZR/TXzcmn58m5o=; b=JCCh+H4z4HMnJH2vg0WI4Pmfiuo4ELm9mRXocUKnbjFAwf3T9+l3vZ3iDltVcXhV9p4zYw DPbXGIPFY6UUuvAPPK1EfvSzXjzI97+whixfyk7YtpaBc6VsUjb658YkV0Yb2GZB19Stkc kTfenvCIaV3z/YXYclN5fNtK3Yoqxd0= X-MC-Unique: f3gaWIDOPH6k2RGklFP43Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/23] qemuDomainGetDiskErrors: Automatically free GHashTable Date: Tue, 30 Nov 2021 15:31:52 +0100 Message-Id: <607e0bd165ee35a3272ee2a126be1d4cecd5792e.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282808625100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/qemu/qemu_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5330a1d3b7..4fcd6190d1 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16439,7 +16439,7 @@ qemuDomainGetDiskErrors(virDomainPtr dom, virQEMUDriver *driver =3D dom->conn->privateData; virDomainObj *vm =3D NULL; qemuDomainObjPrivate *priv; - GHashTable *table =3D NULL; + g_autoptr(GHashTable) table =3D NULL; bool blockdev =3D false; int ret =3D -1; size_t i; @@ -16501,7 +16501,6 @@ qemuDomainGetDiskErrors(virDomainPtr dom, cleanup: virDomainObjEndAPI(&vm); - virHashFree(table); if (ret < 0) { for (i =3D 0; i < n; i++) VIR_FREE(errors[i].disk); --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282808; cv=none; d=zohomail.com; s=zohoarc; b=guY2nM76YdJPmx/ZamFcszst1+aA7k+PkpB3sE/ybxp6mFutgxsAWlzCMwgN7+7XeplY8B0C7CAf8oHIydUufHEArnYoXWOA/HkW3fPV4WJgBcUPesKiZniLTXjjIz6Z4uDVU+/LONdUYDNyeniBA8H72lWLKMuhCJGGjWISVDI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282808; h=Content-Type:Content-Transfer-Encoding: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=kLrNg/H1URlyUldKBByuVcxFE4yaSb7exopQyLZt25w=; b=ErQg29fBuxlnOLGPlBUcB0alxozrkGBYUM7esqATMb1ZS90JRew/8YMQhKAVuEgpMRBwLW4/4LBElgoDDuGx4CpO+VBhJikXg6GGQAX97CJDr7F6HyskZZUExsEt8tGkqirrIzqgrHiBlswayI3OUWoiKDNLud6JeYavflN+bHE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1638282808720721.7125910981075; Tue, 30 Nov 2021 06:33:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-93RG3wHRPZeaJpzD9DhugQ-1; Tue, 30 Nov 2021 09:33:22 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2E6F081CD08; Tue, 30 Nov 2021 14:33:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0ED8819729; Tue, 30 Nov 2021 14:33:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D64361809CB8; Tue, 30 Nov 2021 14:33:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEX9YY022777 for ; Tue, 30 Nov 2021 09:33:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id AD30978C31; Tue, 30 Nov 2021 14:33:09 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 085C56107F for ; Tue, 30 Nov 2021 14:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282807; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kLrNg/H1URlyUldKBByuVcxFE4yaSb7exopQyLZt25w=; b=LcFB/djkUj9fjYmwBTZqgYvtjekmwAsqS2qRX0W4rla0Bqne9ZywA2X/S3F4gkKp8X7nVj eCeBhKx2OnvjdTGiuZPLTF01sb+TjfhmLB/F+gdyT1CRkTJlGSUesxLlmdhHvAHdk0Zudr s5v83W1sePM9CwHt+9CU8rS4+n4IDU8= X-MC-Unique: 93RG3wHRPZeaJpzD9DhugQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/23] qemuMigrationSrcFetchMirrorStats: Automatically free GHashTable Date: Tue, 30 Nov 2021 15:31:53 +0100 Message-Id: <2e06e9ac192e996f90c8718d89d29e1a0ba9fa03.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282809734100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/qemu/qemu_migration.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 8001792f5a..8fb9a3214c 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -6237,7 +6237,7 @@ qemuMigrationSrcFetchMirrorStats(virQEMUDriver *drive= r, size_t i; qemuDomainObjPrivate *priv =3D vm->privateData; bool nbd =3D false; - GHashTable *blockinfo =3D NULL; + g_autoptr(GHashTable) blockinfo =3D NULL; qemuDomainMirrorStats *stats =3D &jobInfo->mirrorStats; for (i =3D 0; i < vm->def->ndisks; i++) { @@ -6274,6 +6274,5 @@ qemuMigrationSrcFetchMirrorStats(virQEMUDriver *drive= r, stats->total +=3D data->end; } - virHashFree(blockinfo); return 0; } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282843; cv=none; d=zohomail.com; s=zohoarc; b=nveb+muedYSFyWlGL7Fapf+wLRXCpMpYZ1cIrp0EbJFDpaRNyO86BkWIJIt/0G7SjnP4qoSL36iaZjQXTS0Y4Y+TR1tazu2W8OieodOPBGiXi1P8WV9c8rL4ApUXCHkopaBc+/hj1oUIM2NutesgJFWJ6kGF/utUqqMsLOcf9b4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282843; h=Content-Type:Content-Transfer-Encoding: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=XXQNZCFd05/vnJ39uAa/9oG/Fbq8Qn8Zg0RfaMj1QgM=; b=fUQzFwHtJ1hyX783NPtf3JzjvtHC3IHEpIZ8xz3RMNNaS1f1+099wCK/tCSm9dNPEUPpX/SRPdUb+ky5hSrHCmIJUaYqDyq7ngPivD5xhhJMkvvkWZtxLUxM9SXH9YJkV78KTZfidkRVukiK72G6UZlG43nJy2OioFVWmHbvzL0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1638282843244212.48364732261507; Tue, 30 Nov 2021 06:34:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-248-AcsZVrI0NJKLytvzY0_8hg-1; Tue, 30 Nov 2021 09:33:25 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5547C81CCBD; Tue, 30 Nov 2021 14:33:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2415E196FF; Tue, 30 Nov 2021 14:33:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E240C1802E24; Tue, 30 Nov 2021 14:33:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXA16022790 for ; Tue, 30 Nov 2021 09:33:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id B945660C13; Tue, 30 Nov 2021 14:33:10 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22F1860C81 for ; Tue, 30 Nov 2021 14:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282842; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XXQNZCFd05/vnJ39uAa/9oG/Fbq8Qn8Zg0RfaMj1QgM=; b=TlQsKLHflOIKJ0kDYiJnZUge4dyNhlHC1nhO4PokY+BUeNrY48ARUdVlAw69xDKxUu+IIH W+ZbI9kDn9jxrIHjbK+b2YXk9yGm6cn6yd+sYRh86O4uGptIihvtTzDDcYj+h0L9tPLhNo /Yw7+jkhRPJUfSZbxlYi2xZuu9yCEYU= X-MC-Unique: AcsZVrI0NJKLytvzY0_8hg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/23] qemuRefreshVirtioChannelState: Automatically free GHashTable and refactor cleanup Date: Tue, 30 Nov 2021 15:31:54 +0100 Message-Id: <66dcf50a2d868dc15c0130495072e902bd4a94a8.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282845282100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/qemu/qemu_process.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c355a39e15..8dface7ec0 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2245,25 +2245,19 @@ qemuRefreshVirtioChannelState(virQEMUDriver *driver, qemuDomainAsyncJob asyncJob) { qemuDomainObjPrivate *priv =3D vm->privateData; - GHashTable *info =3D NULL; - int ret =3D -1; + g_autoptr(GHashTable) info =3D NULL; + int rc; if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) - goto cleanup; - - ret =3D qemuMonitorGetChardevInfo(priv->mon, &info); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret =3D -1; + return -1; - if (ret < 0) - goto cleanup; + rc =3D qemuMonitorGetChardevInfo(priv->mon, &info); + if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + return -1; qemuProcessRefreshChannelVirtioState(driver, vm, info, false); - ret =3D 0; - cleanup: - virHashFree(info); - return ret; + return 0; } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282808; cv=none; d=zohomail.com; s=zohoarc; b=KAUUecqCTm51BX0ZNjh112VaH5okjCut+QoYsmb2eng0ToIzFymg8EDVyegc+KOylEy+SV7MpuHrv58ZG/9kbxw4peCVgJQ3NinxMBBaS68VUWEefXorxXwghN6Q0v5dg8q4uu3CUBrZByookduN5pSyP8dmsjLJbf0HIe31K/Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282808; h=Content-Type:Content-Transfer-Encoding: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=7FNa8iMmL2t5FvpvSXCsfZrqD28xK8acQAeWAxiub+o=; b=EGtSi9kJGQ9KLrK2Rc04yMaQ+X6AwBlLwIAIh+C0ICWbvQQUXqUzzaEnVwy+dA44zDduMdBaaHohm1wdVk+OjPPDXaEkaqTtIf9vZBjW1r4N5U+/F8nF5CNR56e56kHrtnbjIdDoRoRxayxfeLM0ePklv4SphAjBprD8mKIR7iM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 163828280895181.25315345679473; Tue, 30 Nov 2021 06:33:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-149-9YPj0JlRNFmRg7uJoSxazA-1; Tue, 30 Nov 2021 09:33:25 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7279E193248B; Tue, 30 Nov 2021 14:33:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D397D4066; Tue, 30 Nov 2021 14:33:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8FB8A1809CBA; Tue, 30 Nov 2021 14:33:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXB1L022800 for ; Tue, 30 Nov 2021 09:33:12 -0500 Received: by smtp.corp.redhat.com (Postfix) id DDDED60CA1; Tue, 30 Nov 2021 14:33:11 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38D4260C0F for ; Tue, 30 Nov 2021 14:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282807; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=7FNa8iMmL2t5FvpvSXCsfZrqD28xK8acQAeWAxiub+o=; b=DnPXeD6g3vcbMwxM5Rbj20unpRgx/4t3ejNIEZJ5gm3BJjLg2Tub1wXL/0vsExOC2nLg5K gKBrMk1V6Dt4Is7POQlHNRy2KIhQhUwIs+X1CGuAeI+pM0mhIn6ecwgVGjF/RQAR0ia2Hj ystMXARgyTkBf+vwsfUrGhglRcVqRmo= X-MC-Unique: 9YPj0JlRNFmRg7uJoSxazA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/23] qemuRefreshPRManagerState: Automatically free GHashTable and refactor cleanup Date: Tue, 30 Nov 2021 15:31:55 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282809932100004 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/qemu/qemu_process.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 8dface7ec0..2fdd5b95e2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2291,26 +2291,19 @@ qemuRefreshPRManagerState(virQEMUDriver *driver, virDomainObj *vm) { qemuDomainObjPrivate *priv =3D vm->privateData; - GHashTable *info =3D NULL; - int ret =3D -1; + g_autoptr(GHashTable) info =3D NULL; + int rc; if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER) || !qemuDomainDefHasManagedPR(vm)) return 0; qemuDomainObjEnterMonitor(driver, vm); - ret =3D qemuMonitorGetPRManagerInfo(priv->mon, &info); - if (qemuDomainObjExitMonitor(driver, vm) < 0) - ret =3D -1; - - if (ret < 0) - goto cleanup; - - ret =3D qemuProcessRefreshPRManagerState(vm, info); + rc =3D qemuMonitorGetPRManagerInfo(priv->mon, &info); + if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0) + return -1; - cleanup: - virHashFree(info); - return ret; + return qemuProcessRefreshPRManagerState(vm, info); } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282835; cv=none; d=zohomail.com; s=zohoarc; b=BaR0vkgKRggphfaU69tLbRZV+SY22cPeMO2ONfYxXKJMK9Myc/NlHuJPYOIBFKzTNqrt5/txaYUhMc4r7VXbAqUAcP/cQbflO4En92LrAo7LHWVtfsCjPT8mUKuSDnJcFlMl7HAjlBpG3HzMCq2Ll0q3PRr96DmgtYv7cDL3k0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282835; h=Content-Type:Content-Transfer-Encoding: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=B5/Vei24dEbe3ZWcXRVq3Wt6jjd7L/3wJmGGcYfGLGA=; b=ftklhZZRNHz88X+/ypeZSjvJFUm6GekKvPqwXygtsyJR5xe6Qazl+h9FKplFn3W0ZVGIBzMxQA6Soym7rPo0v+OKOEbuyLcswmeBohC0zbGrYc4umCxYDtxxAw0bx63qFfFSVpHcAI+OTII8EBZH+a5bIBgh8FVS0e+84EPiiEs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638282835152915.6576161691416; Tue, 30 Nov 2021 06:33:55 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-226-9sazu2qBNBCPRP6qTcKOFg-1; Tue, 30 Nov 2021 09:33:28 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5613319357B9; Tue, 30 Nov 2021 14:33:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C326378C1B; Tue, 30 Nov 2021 14:33:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 859B94A706; Tue, 30 Nov 2021 14:33:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXDHs022808 for ; Tue, 30 Nov 2021 09:33:13 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0A86860C13; Tue, 30 Nov 2021 14:33:13 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5BD9160C0F for ; Tue, 30 Nov 2021 14:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282834; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=B5/Vei24dEbe3ZWcXRVq3Wt6jjd7L/3wJmGGcYfGLGA=; b=dz4JUsJtnIodqSlMY3P1/kpLom7QgeDa0qfYy7rvNWfWVYOuTqUP4ttx7ZaxZ71qqMgd7G qWXeRpIcIG0UPpm+1h3AuLcsJ35xkZVjoQFD5AqTqGPOCucV0dAUCgEcAZ8dQouw+FEnVV YMa2XOuRvM9WQdFgDBRNWS7prlQpo8U= X-MC-Unique: 9sazu2qBNBCPRP6qTcKOFg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/23] qemuProcessWaitForMonitor: Automatically free GHashTable Date: Tue, 30 Nov 2021 15:31:56 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282836401100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Martin Kletzander --- src/qemu/qemu_process.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 2fdd5b95e2..d1b34612ee 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2392,7 +2392,7 @@ qemuProcessWaitForMonitor(virQEMUDriver *driver, qemuDomainLogContext *logCtxt) { int ret =3D -1; - GHashTable *info =3D NULL; + g_autoptr(GHashTable) info =3D NULL; qemuDomainObjPrivate *priv =3D vm->privateData; bool retry =3D true; @@ -2425,8 +2425,6 @@ qemuProcessWaitForMonitor(virQEMUDriver *driver, } cleanup: - virHashFree(info); - if (logCtxt && kill(vm->pid, 0) =3D=3D -1 && errno =3D=3D ESRCH) { qemuProcessReportLogError(logCtxt, _("process exited while connecting to mo= nitor")); --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282812; cv=none; d=zohomail.com; s=zohoarc; b=Oc36j3rydN17giPMpv+vFTzBiR90/lWXX8AotU2OCS8nNPsAYcmop82KWoRik7/qqKQIwQ5Q9xztbVTrXCKd13+StOd2kNi9er7mcDOI0Mw2L4aRRQW8erwCiGVhMZQoXd+4mHg1BrwQ3PT0wvG0qxvk8HZFf1d314NSqitviv4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282812; h=Content-Type:Content-Transfer-Encoding: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=mX0bdKjIsDRVXIcqASsvjU1HNKB3TeTdm+7jyAvR+ww=; b=RGQEsJ0CDOwHS+JcamCDNvXyjGkW+w9/pGxhPOxo3JKjSMfKOoLsz2Fp4rMzuNCsMeXLsc6fKh4HJlUwSbjv3ZaV0XWQf4PK+afhLEc9PR3WLn3tOYmUsmiHMSPFQy30hO3SHrV63cgV2F5QEmwRYE/fAciP04zu64+htbWsFUM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 163828281289459.90166938199309; Tue, 30 Nov 2021 06:33:32 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-72-b8UThBXxNe6seCACJwfzpQ-1; Tue, 30 Nov 2021 09:33:29 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F14C9100B7A0; Tue, 30 Nov 2021 14:33:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9BA8460C13; Tue, 30 Nov 2021 14:33:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 696D81806D2B; Tue, 30 Nov 2021 14:33:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXEm0022818 for ; Tue, 30 Nov 2021 09:33:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 404FD610A7; Tue, 30 Nov 2021 14:33:14 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CFC460C4A for ; Tue, 30 Nov 2021 14:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282811; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=mX0bdKjIsDRVXIcqASsvjU1HNKB3TeTdm+7jyAvR+ww=; b=HJrycBJfRCzGBa/G3t9XDAJlb5aW+buauBLR+19meYEG6gQE9pyNrjxSRMjNHodXoLzJ9/ xVZImfVSRskreDQmM/78+CGGNi1+1j4ywd0Cm8DCHW9LJj1iQpSvXKnA2qfFgWMD4c5UAX cDPOb7xGlML+RplV+eOKGWq7vqcAeDU= X-MC-Unique: b8UThBXxNe6seCACJwfzpQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/23] qemuProcessRefreshDisks: Automatically free GHashTable and refactor cleanup Date: Tue, 30 Nov 2021 15:31:57 +0100 Message-Id: <82c4e64603f1d22766fcb7a22f30a4e56e6d273a.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282814744100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/qemu/qemu_process.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d1b34612ee..382d562fb1 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8316,18 +8316,17 @@ qemuProcessRefreshDisks(virQEMUDriver *driver, { qemuDomainObjPrivate *priv =3D vm->privateData; bool blockdev =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); - GHashTable *table =3D NULL; - int ret =3D -1; + g_autoptr(GHashTable) table =3D NULL; size_t i; if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) =3D=3D 0) { table =3D qemuMonitorGetBlockInfo(priv->mon); if (qemuDomainObjExitMonitor(driver, vm) < 0) - goto cleanup; + return -1; } if (!table) - goto cleanup; + return -1; for (i =3D 0; i < vm->def->ndisks; i++) { virDomainDiskDef *disk =3D vm->def->disks[i]; @@ -8358,11 +8357,7 @@ qemuProcessRefreshDisks(virQEMUDriver *driver, diskpriv->tray =3D info->tray; } - ret =3D 0; - - cleanup: - virHashFree(table); - return ret; + return 0; } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282816; cv=none; d=zohomail.com; s=zohoarc; b=dUOnPMTG8g/OyJn3lwTHqOiXpJLR5zVrwRMykDVlA3JQJVT1QekkU0kPLIciFHJV4WJV8B9XVIl8JewEE/vQW/1uNHVPImCE8nVbOTus1dh6vn14rOyVZURMEB9v+kTHOTcMOHzkJSMH2hbSX1VHaPaDCTz2sFm6gLuVPgLR38U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282816; h=Content-Type:Content-Transfer-Encoding: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=An5IUe8LambcSTop/dXGTAkXNZf18L3pgQIvp9VCL/g=; b=ISiK2GI/v361tJbzPHRdTHh50Y0V2iV/b7rkdDSjc5MnsirXX1cMy+pm9PtOGrklcdz7vhB9m9tPJaspXVKLdMaKjL8g1B1mrMEF6Pvyh7ayny0qecIt96mInmgemiQQIe0LJgdQAregXJQJCnYwx7cKca4cCUk4jQgkXQamVg0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1638282816510959.0975720707632; Tue, 30 Nov 2021 06:33:36 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-239-sWQzvffPOWOt_C7FDTxx1Q-1; Tue, 30 Nov 2021 09:33:33 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0BD42102C85C; Tue, 30 Nov 2021 14:33:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E08D0694BD; Tue, 30 Nov 2021 14:33:18 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AE22B4A706; Tue, 30 Nov 2021 14:33:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXFpJ022835 for ; Tue, 30 Nov 2021 09:33:15 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6474B60C9F; Tue, 30 Nov 2021 14:33:15 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F2B1610A5 for ; Tue, 30 Nov 2021 14:33:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282815; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=An5IUe8LambcSTop/dXGTAkXNZf18L3pgQIvp9VCL/g=; b=GmgQt6HdzpjQvq5Z3uDl1QT1hCOQYFGboqcn2g3rg7Vg+DPvSA9AdzT4tJWMggxKeKjya6 j0cQVcTAzIP07fK4OI4yVOAtQIXINzlFmL7k48ncLS1Z5NrAbJpiTIzZctvtv+mahRRllo kGQalN0M3aPo8jMNT7te0jzfEtvJ7AA= X-MC-Unique: sWQzvffPOWOt_C7FDTxx1Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 14/23] qemuProcessRefreshLegacyBlockjobs: Automatically free GHashTable and refactor cleanup Date: Tue, 30 Nov 2021 15:31:58 +0100 Message-Id: <6d16fee83837ec71e02177003cabcd9dd532a0ac.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282818371100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/qemu/qemu_process.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 382d562fb1..5bbd03210b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8540,22 +8540,17 @@ static int qemuProcessRefreshLegacyBlockjobs(virQEMUDriver *driver, virDomainObj *vm) { - GHashTable *blockJobs =3D NULL; - int ret =3D -1; + g_autoptr(GHashTable) blockJobs =3D NULL; qemuDomainObjEnterMonitor(driver, vm); blockJobs =3D qemuMonitorGetAllBlockJobInfo(qemuDomainGetMonitor(vm), = true); if (qemuDomainObjExitMonitor(driver, vm) < 0 || !blockJobs) - goto cleanup; + return -1; if (virHashForEach(blockJobs, qemuProcessRefreshLegacyBlockjob, vm) < = 0) - goto cleanup; - - ret =3D 0; + return -1; - cleanup: - virHashFree(blockJobs); - return ret; + return 0; } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282815; cv=none; d=zohomail.com; s=zohoarc; b=khxlCVV0vyVJ+JZT1nwyajVR4UujbyQdqWcAYH4FrodkLwSSl61DCDZOh6UGOozOSGoiTEf0yzfdffUVDrBOd+N6J+ExS8HbatD8V7kgkIXczTkF2FY13NLo50ce/RqzYHi0K73zJ3PxjRqGnfcPaMsG/aI3DcCaF+/RYQ2RovU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282815; h=Content-Type:Content-Transfer-Encoding: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=A62S3NCUDEylAmEYtyBgqFoK85HGwNs5Pc7QPi83mV0=; b=UOR7qG2TMVJNei/eM1ecszG0z5gdFawvloP9Bz/jMTp6Z/ZmXsjKDzWPkNrZ0+ctMMPzDSXYZxpvaBiVqX6ZEmPUjk5n27KAXBy2l5ThwRA9eamkB2Xuq+N2tjG7XX8ndnbqRy76SMQdEdczTcFsFXOuQEZZ4zHTEoWz27oTH4Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638282815439503.6168672720304; Tue, 30 Nov 2021 06:33:35 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-582-qKKofbMRPYuqEq2wVWguKw-1; Tue, 30 Nov 2021 09:33:32 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 45FEE83DD2F; Tue, 30 Nov 2021 14:33:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B83E610A8; Tue, 30 Nov 2021 14:33:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 95EF01806D2E; Tue, 30 Nov 2021 14:33:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXGYc022846 for ; Tue, 30 Nov 2021 09:33:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7AB29610A5; Tue, 30 Nov 2021 14:33:16 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id CDA81610A7 for ; Tue, 30 Nov 2021 14:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282814; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=A62S3NCUDEylAmEYtyBgqFoK85HGwNs5Pc7QPi83mV0=; b=Ujtm5u7tt9V9/hUpCGh7zGh2SbbPwMtvJ9fKi8WoYNmuv168K9sQsj8tuEpRQ0ci8WZBo6 kpSVXkeUFtUpQdEW0e39gWZMyR3SqDERFwpFIU4280m7Ck3+XHHAo1eif9Ejuc/BkaFRfk 0qEKUtKy5dX5/DS0k+BfhB8dsOWSoxY= X-MC-Unique: qKKofbMRPYuqEq2wVWguKw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 15/23] qemuCheckpointGetXMLDescUpdateSize: Don't combine automatic freeing with manual Date: Tue, 30 Nov 2021 15:31:59 +0100 Message-Id: <5f2738643ff9ca971167426c19c1f4c136f4e466.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282815980100005 Content-Type: text/plain; charset="utf-8" 'blockNamedNodeData' is declared for automatic freeing but we also free it manually and reuse which is a code pattern we don't normally allow. Rewrite the code to have actually two separate hash tables. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/qemu/qemu_checkpoint.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_checkpoint.c b/src/qemu/qemu_checkpoint.c index 4902585e5d..72f34ec86d 100644 --- a/src/qemu/qemu_checkpoint.c +++ b/src/qemu/qemu_checkpoint.c @@ -647,7 +647,8 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, { qemuDomainObjPrivate *priv =3D vm->privateData; virQEMUDriver *driver =3D priv->driver; - g_autoptr(GHashTable) blockNamedNodeData =3D NULL; + g_autoptr(GHashTable) nodedataMerge =3D NULL; + g_autoptr(GHashTable) nodedataStats =3D NULL; g_autofree struct qemuCheckpointDiskMap *diskmap =3D NULL; g_autoptr(virJSONValue) recoveractions =3D NULL; g_autoptr(virJSONValue) mergeactions =3D virJSONValueNewArray(); @@ -663,7 +664,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, if (virDomainObjCheckActive(vm) < 0) goto endjob; - if (!(blockNamedNodeData =3D qemuBlockGetNamedNodeData(vm, QEMU_ASYNC_= JOB_NONE))) + if (!(nodedataMerge =3D qemuBlockGetNamedNodeData(vm, QEMU_ASYNC_JOB_N= ONE))) goto endjob; /* enumerate disks relevant for the checkpoint which are also present = in the @@ -683,7 +684,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, if (!(domdisk =3D virDomainDiskByTarget(vm->def, chkdisk->name))) continue; - if (!qemuBlockBitmapChainIsValid(domdisk->src, chkdef->parent.name= , blockNamedNodeData)) + if (!qemuBlockBitmapChainIsValid(domdisk->src, chkdef->parent.name= , nodedataMerge)) continue; diskmap[ndisks].chkdisk =3D chkdisk; @@ -702,7 +703,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, g_autoptr(virJSONValue) actions =3D NULL; /* possibly delete leftovers from previous cases */ - if (qemuBlockNamedNodeDataGetBitmapByName(blockNamedNodeData, domd= isk->src, + if (qemuBlockNamedNodeDataGetBitmapByName(nodedataMerge, domdisk->= src, "libvirt-tmp-size-xml"))= { if (!recoveractions) recoveractions =3D virJSONValueNewArray(); @@ -715,7 +716,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, if (qemuBlockGetBitmapMergeActions(domdisk->src, NULL, domdisk->sr= c, chkdef->parent.name, "libvirt-t= mp-size-xml", - NULL, &actions, blockNamedNodeD= ata) < 0) + NULL, &actions, nodedataMerge) = < 0) goto endjob; if (virJSONValueArrayConcat(mergeactions, actions) < 0) @@ -739,8 +740,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, goto endjob; /* now do a final refresh */ - virHashFree(blockNamedNodeData); - if (!(blockNamedNodeData =3D qemuBlockGetNamedNodeData(vm, QEMU_ASYNC_= JOB_NONE))) + if (!(nodedataStats =3D qemuBlockGetNamedNodeData(vm, QEMU_ASYNC_JOB_N= ONE))) goto endjob; qemuDomainObjEnterMonitor(driver, vm); @@ -756,7 +756,7 @@ qemuCheckpointGetXMLDescUpdateSize(virDomainObj *vm, virDomainDiskDef *domdisk =3D diskmap[i].domdisk; qemuBlockNamedNodeDataBitmap *bitmap; - if ((bitmap =3D qemuBlockNamedNodeDataGetBitmapByName(blockNamedNo= deData, domdisk->src, + if ((bitmap =3D qemuBlockNamedNodeDataGetBitmapByName(nodedataStat= s, domdisk->src, "libvirt-tmp-s= ize-xml"))) { chkdisk->size =3D bitmap->dirtybytes; chkdisk->sizeValid =3D true; --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282881; cv=none; d=zohomail.com; s=zohoarc; b=JmPjZJcxgvbf2zJgvm1pZhPQMv7FyRNGVZFSJkTEyGSPdvaIrXbnxdaV3i8ZTs8zP+xOVdjToAXc/ccO/fB1Ml+zrgFtHxzp5uGB5hBvQSj8sL2nwjtDqh698aa/8cXd2yxmSnDVfmB6W3wRf+FyxYHVnY93NHjGSAKZEMJcoSw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282881; h=Content-Type:Content-Transfer-Encoding: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=I+sPhlcpF8SYjUdo5m03veqj5ICq7OvK+51qgBJwxPQ=; b=FkO+uXzz1cAckbSoPl+dfpR5twYAay5Yugm6s4SzKDhyQK5VL1WvPZYV/Xhxtfp7YjMcJy8ZlXiYhD248ZwPps7A2Hh7MbFWyk2ZogMSKBp3KjrGqA7LwfqaUd8M2jtOy5WxZXHSxoyAPvBcGQAGBqEa9OEXAVSUUkR76wJnbD0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1638282881268329.4685240554812; Tue, 30 Nov 2021 06:34:41 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-385-qs7mCADvOIqupaIUsSEklQ-1; Tue, 30 Nov 2021 09:33:32 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC236344E2; Tue, 30 Nov 2021 14:33:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BA703100EBB8; Tue, 30 Nov 2021 14:33:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 89ADD1806D2B; Tue, 30 Nov 2021 14:33:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXHEB022864 for ; Tue, 30 Nov 2021 09:33:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 928B260C81; Tue, 30 Nov 2021 14:33:17 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC86060FDD for ; Tue, 30 Nov 2021 14:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282880; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=I+sPhlcpF8SYjUdo5m03veqj5ICq7OvK+51qgBJwxPQ=; b=Ac6pCPUXeuK5vZo3LJKOF571BGei4KJVT6uOmAuk4vHKOpjCdhNLV9FBm9n5PboeePWOEb rlP132rOpWiJIOBU44xy78Fx500xctMjvvnwV4ywFXOHSAamGI0eDI0L4cZqWOIxYPMTnx 1ciTrhF/7rIHkoko6KN/ASD1UcsF6so= X-MC-Unique: qs7mCADvOIqupaIUsSEklQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 16/23] nwfilterxml2firewalltest: virNWFilterIncludeDefToRuleInst: Automatically free GHashTable Date: Tue, 30 Nov 2021 15:32:00 +0100 Message-Id: <6e97f683cd5637d1b764061a69a61ce7938fc730.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282882117100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: Martin Kletzander --- tests/nwfilterxml2firewalltest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewallt= est.c index 3e8436a98c..6ab62f60c9 100644 --- a/tests/nwfilterxml2firewalltest.c +++ b/tests/nwfilterxml2firewalltest.c @@ -227,7 +227,7 @@ virNWFilterIncludeDefToRuleInst(virNWFilterIncludeDef *= inc, GHashTable *vars, virNWFilterInst *inst) { - GHashTable *tmpvars =3D NULL; + g_autoptr(GHashTable) tmpvars =3D NULL; int ret =3D -1; g_autofree char *xml =3D NULL; @@ -248,7 +248,6 @@ virNWFilterIncludeDefToRuleInst(virNWFilterIncludeDef *= inc, cleanup: if (ret < 0) virNWFilterInstReset(inst); - virHashFree(tmpvars); return ret; } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282817; cv=none; d=zohomail.com; s=zohoarc; b=WRpHDKLUS6yop4RIUFgWdfLI8uUIED4uNyp9khfhuC/WMDpJs0pXAVIyfMcKiWicJcAUHoCf35xGHXQgr4GuBvB+EC5ZoD+XYV0pEDyaV9aCzVn1V+usqqqFEF3/0YIGw5Nna/1+V1MyIXqsG0Ww1TCatV+CeoAwoOFJip1uNjc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282817; h=Content-Type:Content-Transfer-Encoding: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=fqhbr64cfr4K5Ftubu1Eg7XexqoB05qS5w/0rq/bU4k=; b=c9CxdPu3+UlMvL8j0ExcruychXXG8Pb4WMftPw445styKIn52szwPmhtYmYuNwb0BN4kokQ5bt0X+aTvLKJV/azQsiG6JVh64Bps3O71xKOMewU78ceDGtqP0ArF2Qt1j98RUSvTKuwh1fuHHzjGgC8p3itSRbBLudHRnqoRdmo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1638282817966428.9188277862813; Tue, 30 Nov 2021 06:33:37 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-463-ub8KrznbOlCuOG577nq2Pg-1; Tue, 30 Nov 2021 09:33:34 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D4E68180FD79; Tue, 30 Nov 2021 14:33:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A6F1B60CA1; Tue, 30 Nov 2021 14:33:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 68B1F4A705; Tue, 30 Nov 2021 14:33:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXIwL022872 for ; Tue, 30 Nov 2021 09:33:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id AA32D610F6; Tue, 30 Nov 2021 14:33:18 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A21660C0F for ; Tue, 30 Nov 2021 14:33:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282816; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=fqhbr64cfr4K5Ftubu1Eg7XexqoB05qS5w/0rq/bU4k=; b=dm1p85GloiVK2xFHRrxJPEzk/3RC4lYYHTfcxsRJGTBUVBANAp9lJM+JXVcqqaZ9te8Ubi q0V6HxyqN0UQ/NdwVOxXbcyTg6MdN2VHmmp8SMuTgkPMawW7oL+R4AVF8F/bFj0BEicTT8 mI46F5JXOEps1bOaNWAngm6kRqcsyx8= X-MC-Unique: ub8KrznbOlCuOG577nq2Pg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 17/23] nwfilterxml2firewalltest: testCompareXMLToArgvFiles: Automatically free GHashTable Date: Tue, 30 Nov 2021 15:32:01 +0100 Message-Id: <9fec20fa9aa178e4259f61680f021e437d77a916.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282818715100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- tests/nwfilterxml2firewalltest.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewallt= est.c index 6ab62f60c9..315afddca0 100644 --- a/tests/nwfilterxml2firewalltest.c +++ b/tests/nwfilterxml2firewalltest.c @@ -350,7 +350,7 @@ static int testCompareXMLToArgvFiles(const char *xml, { g_autofree char *actualargv =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - GHashTable *vars =3D virHashNew(virNWFilterVarValueHashFree); + g_autoptr(GHashTable) vars =3D virHashNew(virNWFilterVarValueHashFree); virNWFilterInst inst; int ret =3D -1; g_autoptr(virCommandDryRunToken) dryRunToken =3D virCommandDryRunToken= New(); @@ -381,7 +381,6 @@ static int testCompareXMLToArgvFiles(const char *xml, cleanup: virNWFilterInstReset(&inst); - virHashFree(vars); return ret; } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282814; cv=none; d=zohomail.com; s=zohoarc; b=V01BIYY1tg7w8RaVQZ8Q3sWT4qlJYhp9Cg09IbDYY6InHbnol5Dm6snzB6P4876+a/zxufDhcFUAYqEnomYZdr2q5GhLzv49KB5mt7b+k2Y7ZLeucUkC9skhVmecGIobfkv5mS3C7LKEElBxC62k20e2NTRlchfNqPGUc50QklI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282814; h=Content-Type:Content-Transfer-Encoding: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=mgRgvKp2f3a2yYeQEoIwpjdMpXH17r+IKP4I5tagfMw=; b=bz8wxthFRMUUHKCc4q6w8eUYIFUCWkVIMYTabtjZurSX/N75htZ0lvzFnZA07PSRZElBOEh24IhL2nzQrvoBNk+NVeg4G3gaTWqoZ7jkSizc3zWV3l9Vj/7uEoBRcwygl4rui8nW/TBn3y90dm9YF1gE4MLmEZoqqMk5iNkvF18= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638282814916571.3125491514292; Tue, 30 Nov 2021 06:33:34 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-190-3NZsFFC4M3u6dP4OLD22Tg-1; Tue, 30 Nov 2021 09:33:32 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8559083DAA4; Tue, 30 Nov 2021 14:33:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 67953100EBAD; Tue, 30 Nov 2021 14:33:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 27D7D1806D2B; Tue, 30 Nov 2021 14:33:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXJZp022882 for ; Tue, 30 Nov 2021 09:33:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id D6EAA78C19; Tue, 30 Nov 2021 14:33:19 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2556160CA1 for ; Tue, 30 Nov 2021 14:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282813; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=mgRgvKp2f3a2yYeQEoIwpjdMpXH17r+IKP4I5tagfMw=; b=ZWnPFp2WkoQFQb1gw1yze7yiV0/rSkzVjjQcKKfatYQz7T25gKwbQ0mChgeZVTbSfJPAbI xt58BoxgqOiCxw8wlhGID1ivSwrhCzEQXW5h48BhJoInCb/KwlHyrWailZ11RWW5ZlNLx3 LRv30kF68D+fCkwCxvrXGM6IhFqUOa8= X-MC-Unique: 3NZsFFC4M3u6dP4OLD22Tg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 18/23] qemumonitorjsontest: testBlockNodeNameDetect: Automatically free GHashTable Date: Tue, 30 Nov 2021 15:32:02 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282815723100003 Content-Type: text/plain; charset="utf-8" Additionally we no longer need the cleanup section. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- tests/qemumonitorjsontest.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index bcf5caa9a4..91a9193f2a 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2490,24 +2490,23 @@ testBlockNodeNameDetect(const void *opaque) g_autofree char *actual =3D NULL; g_autoptr(virJSONValue) namedNodesJson =3D NULL; g_autoptr(virJSONValue) blockstatsJson =3D NULL; - GHashTable *nodedata =3D NULL; + g_autoptr(GHashTable) nodedata =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - int ret =3D -1; resultFile =3D g_strdup_printf("%s/%s%s.result", abs_srcdir, pathprefi= x, testname); if (!(namedNodesJson =3D virTestLoadFileJSON(pathprefix, testname, "-named-nodes.json", NULL))) - goto cleanup; + return -1; if (!(blockstatsJson =3D virTestLoadFileJSON(pathprefix, testname, "-blockstats.json", NULL))) - goto cleanup; + return -1; if (!(nodedata =3D qemuBlockNodeNameGetBackingChain(namedNodesJson, blockstatsJson))) - goto cleanup; + return -1; virHashForEachSorted(nodedata, testBlockNodeNameDetectFormat, &buf); @@ -2516,14 +2515,9 @@ testBlockNodeNameDetect(const void *opaque) actual =3D virBufferContentAndReset(&buf); if (virTestCompareToFile(actual, resultFile) < 0) - goto cleanup; - - ret =3D 0; - - cleanup: - virHashFree(nodedata); + return -1; - return ret; + return 0; } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282845; cv=none; d=zohomail.com; s=zohoarc; b=gOmPGDa9EgoFGqlXcukDO0WzVCsIY4ZyC4EuIBUv4yfaltmeoXbF5ACnw9sGxHVMr6Fi5EO1+K7JeqajQVuXJ+k5vKun57YsGwgf2wEzb3WsqJCyFa4Lr98jPWlVsYBdtP9VVyFcQbrNwLzv7GxTZoUmHSuz9O0IgX6CO6CYmSg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282845; h=Content-Type:Content-Transfer-Encoding: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=42BQVCq0b/1BnIKUxu3jRxT8LdLp+bjXg2clOft+0do=; b=A2Kj7CzsbAp352fFYS/hlJai4uYHYPaClBkQgNc9eUXqyNEev7rNzXJeHviQwZqrp8HphylOxwtyIYitlwPHY//zi9f9z2g8PZi5olzwLeft0iCaEzFoZaLj8Hy8qbTBgLrScVNjdm20HHLn19golcqhSJgxlAZirw45iJOuf8s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1638282845823795.157675364251; Tue, 30 Nov 2021 06:34:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-36-kNDMxSvdPee-B_Mbklv1DA-1; Tue, 30 Nov 2021 09:33:34 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6B2541015DC1; Tue, 30 Nov 2021 14:33:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4F04760854; Tue, 30 Nov 2021 14:33:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E87C04A70B; Tue, 30 Nov 2021 14:33:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXKQR022897 for ; Tue, 30 Nov 2021 09:33:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id E7EB860C13; Tue, 30 Nov 2021 14:33:20 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5351D78C34 for ; Tue, 30 Nov 2021 14:33:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282844; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=42BQVCq0b/1BnIKUxu3jRxT8LdLp+bjXg2clOft+0do=; b=NOAYKdjQ1bM+AmmGtyx+Blj0OW8rDolfpPbt8+vytQN0FMN/1gri+CnqwUoMGDk+pACNsh YNU/DC1OB2Nq+rG+ruZODZFiAFD6kwe5TPq49ToSlXv+Bnep5wdjYmmUllXedXwcXc8fp3 5T7p8PFvcoqJ9+MUn1Zc81HbC10hvDk= X-MC-Unique: kNDMxSvdPee-B_Mbklv1DA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 19/23] qemumonitorjsontest: mymain: Automatically free GHashTable Date: Tue, 30 Nov 2021 15:32:03 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282847798100001 Content-Type: text/plain; charset="utf-8" Use separate automatically cleared variables for the x86_64 and s390 versions of the QAPI schema. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- tests/qemumonitorjsontest.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 91a9193f2a..4c882fa5d3 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2890,6 +2890,8 @@ mymain(void) int ret =3D 0; virQEMUDriver driver; testQemuMonitorJSONSimpleFuncData simpleFunc; + g_autoptr(GHashTable) qapischema_x86_64 =3D NULL; + g_autoptr(GHashTable) qapischema_s390x =3D NULL; struct testQAPISchemaData qapiData; g_autoptr(virJSONValue) metaschema =3D NULL; g_autofree char *metaschemastr =3D NULL; @@ -2899,12 +2901,14 @@ mymain(void) virEventRegisterDefaultImpl(); - if (!(qapiData.schema =3D testQEMUSchemaLoadLatest("x86_64"))) { - VIR_TEST_VERBOSE("failed to load qapi schema"); + if (!(qapischema_x86_64 =3D testQEMUSchemaLoadLatest("x86_64"))) { + VIR_TEST_VERBOSE("failed to load x86_64 qapi schema"); ret =3D -1; goto cleanup; } + qapiData.schema =3D qapischema_x86_64; + #define DO_TEST(name) \ do { \ testGenericData data =3D { driver.xmlopt, qapiData.schema }; \ @@ -3171,18 +3175,18 @@ mymain(void) #undef DO_TEST_QUERY_JOBS - virHashFree(qapiData.schema); - if (!(qapiData.schema =3D testQEMUSchemaLoadLatest("s390x"))) { + if (!(qapischema_s390x =3D testQEMUSchemaLoadLatest("s390x"))) { VIR_TEST_VERBOSE("failed to load qapi schema for s390x"); ret =3D -1; goto cleanup; } + qapiData.schema =3D qapischema_s390x; + DO_TEST(qemuMonitorJSONGetCPUModelComparison); DO_TEST(qemuMonitorJSONGetCPUModelBaseline); cleanup: - virHashFree(qapiData.schema); qemuTestDriverFree(&driver); return (ret =3D=3D 0) ? EXIT_SUCCESS : EXIT_FAILURE; } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282914; cv=none; d=zohomail.com; s=zohoarc; b=LACoAmv4VwiVDGEUZbTrKN38gTk3MQr1RebZmOObYTel/GjTLN0QhuOQZyH2sakZfPUZuOhF/gDHcujHNVwUoQg8V5p/gCVBmE5OJ4mVxKFn2glNdsf/SiX4d6+EDUVNSZUG8eb6SN282G+J4kcbnRNMjDCJH2XM5nsmmlgI/Ts= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282914; h=Content-Type:Content-Transfer-Encoding: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=7Bx+J1aDE/53u/qWW3Dv/eFEhudxQm8y3GsovFyzHn0=; b=WPukwcnGII0ryW2VHzlSW0mikay8VPcLfWpJJ4tY9R4NxeQYnl6DADV4qSB00Mfme2BGoZP0/P9FJQJbh78/GoPLBFIClCOeuv4x643LLz6AI20+K9ruRCK/sUuPFw9tYSrTdDhbXWz5P+SWUZr1I/t4gmHtzFtTYLnUFMDKySE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 163828291483327.3898175050831; Tue, 30 Nov 2021 06:35:14 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-595-XsjokoiYN6WYeKPr2vARoQ-1; Tue, 30 Nov 2021 09:33:39 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AAB758042FA; Tue, 30 Nov 2021 14:33:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8FE7D694BD; Tue, 30 Nov 2021 14:33:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5B2641806D2B; Tue, 30 Nov 2021 14:33:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXMs1022911 for ; Tue, 30 Nov 2021 09:33:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0D7FC60C0F; Tue, 30 Nov 2021 14:33:22 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5817D60C13 for ; Tue, 30 Nov 2021 14:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282913; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=7Bx+J1aDE/53u/qWW3Dv/eFEhudxQm8y3GsovFyzHn0=; b=L/8GVKByNlILMhv7wAKcM8xHGjQ5ZypOLiXf2/iXK/DJCepEReMAdEOdLaUeC3ySq2Q9as KaYAmsN1jIH+mDGIFy5H6tw7s1dx08a5+zSWM9XFZzbhCufF5BnedWYStuTWS+TYYG3Qiq 2zQTnqs2IUkH2gO4lOV8ErIX/+nOWiY= X-MC-Unique: XsjokoiYN6WYeKPr2vARoQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 20/23] qemuxml2arvtest: Use 'g_hash_table_unref' for clearing the qapi schema cache Date: Tue, 30 Nov 2021 15:32:04 +0100 Message-Id: <35aa0fbda5fe65f08742999ac01c586f2ac94fec.1638282671.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282915237100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- tests/qemuxml2argvtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b3fa676af7..5e4cd7389c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -823,7 +823,7 @@ mymain(void) int ret =3D 0; g_autofree char *fakerootdir =3D NULL; g_autoptr(GHashTable) capslatest =3D testQemuGetLatestCaps(); - g_autoptr(GHashTable) qapiSchemaCache =3D virHashNew((GDestroyNotify) = virHashFree); + g_autoptr(GHashTable) qapiSchemaCache =3D virHashNew((GDestroyNotify) = g_hash_table_unref); g_autoptr(GHashTable) capscache =3D virHashNew(virObjectFreeHashData); struct testQemuConf testConf =3D { .capslatest =3D capslatest, .capscache =3D capscache, --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282849; cv=none; d=zohomail.com; s=zohoarc; b=jSz4MJFbDCr9hi1gwZysRXc7NocmU6T134RGUsur9stAqqYpmbHigKcM2mEqH3ZK+3aUvx4NB/yCEq4aeiAXuQhMnbomV5eAFv2mhsuFHbozG7bsu1/huw1A9VzupM72W+EQXvOXQqpnd+kdI+qf7R5eS1/td9nF6S4+deUWkI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282849; h=Content-Type:Content-Transfer-Encoding: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=wjSIfNvgrlgKEB8gWlzqc9XJtv3KLWnzgKqS2UweYqQ=; b=Aghk9AwlTWaobnglG/PszfZxKS5z7XAoZLmOOqNeOU00QzUgbfEqal4BOmUxaIv1vflkqlZrsMM/RxZjrmR6Tc+eJAJ0I7scpRHsbFnj9QHtX2NFnquWTadIYEMg5O2wGObpqEGcI+m3beXs6fXXduhdnfru5pDAaq+6+SeGaQc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 163828284956274.22784508900565; Tue, 30 Nov 2021 06:34:09 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-463-kQ8jd-LPP0u98yyxKvBaIg-1; Tue, 30 Nov 2021 09:33:36 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A78AE84B27B; Tue, 30 Nov 2021 14:33:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 800B660C0F; Tue, 30 Nov 2021 14:33:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 20AA74A706; Tue, 30 Nov 2021 14:33:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXNCQ022948 for ; Tue, 30 Nov 2021 09:33:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5D56060C13; Tue, 30 Nov 2021 14:33:23 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 838FD5023B for ; Tue, 30 Nov 2021 14:33:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282848; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wjSIfNvgrlgKEB8gWlzqc9XJtv3KLWnzgKqS2UweYqQ=; b=fnc4DO80d9mvPOHaXfq5vAQBn+4k0LY7fWMZNXesrULL7+6L1heoyA8e5ejMB3empPPa/w ynH/1xAWjXjMtHmumm6O8odp+esTpxZWs2Gu+Slx/fQPZ0Gg730auYH8Tyen23ebIYfsAK 5QI1zLbwGXj/it8xtKR9fkqPbzJdn4g= X-MC-Unique: kQ8jd-LPP0u98yyxKvBaIg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 21/23] Switch away from virHashFree Date: Tue, 30 Nov 2021 15:32:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282851081100001 Content-Type: text/plain; charset="utf-8" Use 'g_clear_pointer(&ptr, g_hash_table_unref)' instead. In few instances it allows us to also remove explicit clearing of pointers. Signed-off-by: Peter Krempa Reviewed-by: Martin Kletzander --- src/conf/domain_addr.c | 2 +- src/conf/domain_conf.c | 2 +- src/conf/nwfilter_conf.c | 2 +- src/conf/nwfilter_ipaddrmap.c | 3 +-- src/conf/virchrdev.c | 2 +- src/conf/virdomainmomentobjlist.c | 2 +- src/conf/virdomainobjlist.c | 4 ++-- src/conf/virinterfaceobj.c | 2 +- src/conf/virnetworkobj.c | 4 ++-- src/conf/virnodedeviceobj.c | 2 +- src/conf/virnwfilterbindingdef.c | 2 +- src/conf/virnwfilterbindingobjlist.c | 2 +- src/conf/virsecretobj.c | 2 +- src/conf/virstorageobj.c | 10 +++++----- src/hyperv/hyperv_wmi.c | 2 +- src/hypervisor/virclosecallbacks.c | 2 +- src/libxl/libxl_logger.c | 2 +- src/locking/lock_daemon.c | 2 +- src/nwfilter/nwfilter_dhcpsnoop.c | 6 +++--- src/nwfilter/nwfilter_gentech_driver.c | 2 +- src/nwfilter/nwfilter_learnipaddr.c | 7 ++----- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_driver.c | 2 +- src/rpc/virnetdaemon.c | 2 +- src/security/security_selinux.c | 6 +++--- src/util/virfilecache.c | 2 +- src/util/virhash.c | 2 +- src/util/virlockspace.c | 2 +- src/util/virmacmap.c | 2 +- src/util/virsystemd.c | 2 +- tests/nwfilterxml2firewalltest.c | 2 +- tests/qemusecuritymock.c | 7 +++---- 32 files changed, 45 insertions(+), 50 deletions(-) diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index a06721c35d..49745ba881 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -1377,7 +1377,7 @@ void virDomainCCWAddressSetFree(virDomainCCWAddressSe= t *addrs) if (!addrs) return; - virHashFree(addrs->defined); + g_clear_pointer(&addrs->defined, g_hash_table_unref); g_free(addrs); } diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 25e504a99a..9be5a94680 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2640,7 +2640,7 @@ virDomainNetDefFree(virDomainNetDef *def) virDomainDeviceInfoClear(&def->info); g_free(def->filter); - virHashFree(def->filterparams); + g_clear_pointer(&def->filterparams, g_hash_table_unref); virNetDevBandwidthFree(def->bandwidth); virNetDevVlanClear(&def->vlan); diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index a3109962af..3fedfdde56 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -323,7 +323,7 @@ virNWFilterIncludeDefFree(virNWFilterIncludeDef *inc) { if (!inc) return; - virHashFree(inc->params); + g_clear_pointer(&inc->params, g_hash_table_unref); g_free(inc->filterref); g_free(inc); } diff --git a/src/conf/nwfilter_ipaddrmap.c b/src/conf/nwfilter_ipaddrmap.c index bc21c80536..e2f123b9d9 100644 --- a/src/conf/nwfilter_ipaddrmap.c +++ b/src/conf/nwfilter_ipaddrmap.c @@ -156,6 +156,5 @@ virNWFilterIPAddrMapInit(void) void virNWFilterIPAddrMapShutdown(void) { - virHashFree(ipAddressMap); - ipAddressMap =3D NULL; + g_clear_pointer(&ipAddressMap, g_hash_table_unref); } diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c index 5d6de68427..b5477b03d5 100644 --- a/src/conf/virchrdev.c +++ b/src/conf/virchrdev.c @@ -295,7 +295,7 @@ void virChrdevFree(virChrdevs *devs) virMutexLock(&devs->lock); virHashForEachSafe(devs->hash, virChrdevFreeClearCallbacks, NULL); - virHashFree(devs->hash); + g_clear_pointer(&devs->hash, g_hash_table_unref); virMutexUnlock(&devs->lock); virMutexDestroy(&devs->lock); diff --git a/src/conf/virdomainmomentobjlist.c b/src/conf/virdomainmomentob= jlist.c index 17b9c16ae7..60f7eec106 100644 --- a/src/conf/virdomainmomentobjlist.c +++ b/src/conf/virdomainmomentobjlist.c @@ -282,7 +282,7 @@ virDomainMomentObjListFree(virDomainMomentObjList *mome= nts) { if (!moments) return; - virHashFree(moments->objs); + g_clear_pointer(&moments->objs, g_hash_table_unref); g_free(moments); } diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c index 063c63cd30..9be1e7ad7d 100644 --- a/src/conf/virdomainobjlist.c +++ b/src/conf/virdomainobjlist.c @@ -85,8 +85,8 @@ static void virDomainObjListDispose(void *obj) { virDomainObjList *doms =3D obj; - virHashFree(doms->objs); - virHashFree(doms->objsName); + g_clear_pointer(&doms->objs, g_hash_table_unref); + g_clear_pointer(&doms->objsName, g_hash_table_unref); } diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c index daac74e88c..9d75be6425 100644 --- a/src/conf/virinterfaceobj.c +++ b/src/conf/virinterfaceobj.c @@ -345,7 +345,7 @@ virInterfaceObjListDispose(void *obj) { virInterfaceObjList *interfaces =3D obj; - virHashFree(interfaces->objsName); + g_clear_pointer(&interfaces->objsName, g_hash_table_unref); } diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index f1baffc516..41c7dcba5c 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -464,7 +464,7 @@ virNetworkObjDispose(void *opaque) { virNetworkObj *obj =3D opaque; - virHashFree(obj->ports); + g_clear_pointer(&obj->ports, g_hash_table_unref); virNetworkDefFree(obj->def); virNetworkDefFree(obj->newDef); virBitmapFree(obj->classIdMap); @@ -477,7 +477,7 @@ virNetworkObjListDispose(void *opaque) { virNetworkObjList *nets =3D opaque; - virHashFree(nets->objs); + g_clear_pointer(&nets->objs, g_hash_table_unref); } diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 15898a6aa7..2e4ef2df3c 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -453,7 +453,7 @@ virNodeDeviceObjListDispose(void *obj) { virNodeDeviceObjList *devs =3D obj; - virHashFree(devs->objs); + g_clear_pointer(&devs->objs, g_hash_table_unref); } diff --git a/src/conf/virnwfilterbindingdef.c b/src/conf/virnwfilterbinding= def.c index 488fdbceab..c55a5d28dc 100644 --- a/src/conf/virnwfilterbindingdef.c +++ b/src/conf/virnwfilterbindingdef.c @@ -40,7 +40,7 @@ virNWFilterBindingDefFree(virNWFilterBindingDef *def) g_free(def->portdevname); g_free(def->linkdevname); g_free(def->filter); - virHashFree(def->filterparams); + g_clear_pointer(&def->filterparams, g_hash_table_unref); g_free(def); } diff --git a/src/conf/virnwfilterbindingobjlist.c b/src/conf/virnwfilterbin= dingobjlist.c index 212cca2265..03441c9c1b 100644 --- a/src/conf/virnwfilterbindingobjlist.c +++ b/src/conf/virnwfilterbindingobjlist.c @@ -77,7 +77,7 @@ virNWFilterBindingObjListDispose(void *obj) { virNWFilterBindingObjList *bindings =3D obj; - virHashFree(bindings->objs); + g_clear_pointer(&bindings->objs, g_hash_table_unref); } diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c index 3fbee6f6ec..a88f28fdda 100644 --- a/src/conf/virsecretobj.c +++ b/src/conf/virsecretobj.c @@ -149,7 +149,7 @@ virSecretObjListDispose(void *obj) { virSecretObjList *secrets =3D obj; - virHashFree(secrets->objs); + g_clear_pointer(&secrets->objs, g_hash_table_unref); } diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 2c29339b6a..02903ac487 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -183,9 +183,9 @@ virStorageVolObjListDispose(void *opaque) { virStorageVolObjList *vols =3D opaque; - virHashFree(vols->objsKey); - virHashFree(vols->objsName); - virHashFree(vols->objsPath); + g_clear_pointer(&vols->objsKey, g_hash_table_unref); + g_clear_pointer(&vols->objsName, g_hash_table_unref); + g_clear_pointer(&vols->objsPath, g_hash_table_unref); } @@ -382,8 +382,8 @@ virStoragePoolObjListDispose(void *opaque) { virStoragePoolObjList *pools =3D opaque; - virHashFree(pools->objs); - virHashFree(pools->objsName); + g_clear_pointer(&pools->objs, g_hash_table_unref); + g_clear_pointer(&pools->objsName, g_hash_table_unref); } diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index e211fd5d80..6712ef4835 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -357,7 +357,7 @@ hypervAddEmbeddedParam(hypervInvokeParamsList *params, void hypervFreeEmbeddedParam(GHashTable *p) { - virHashFree(p); + g_clear_pointer(&p, g_hash_table_unref); } diff --git a/src/hypervisor/virclosecallbacks.c b/src/hypervisor/vircloseca= llbacks.c index 2578a71f03..84a61b002a 100644 --- a/src/hypervisor/virclosecallbacks.c +++ b/src/hypervisor/virclosecallbacks.c @@ -78,7 +78,7 @@ virCloseCallbacksDispose(void *obj) { virCloseCallbacks *closeCallbacks =3D obj; - virHashFree(closeCallbacks->list); + g_clear_pointer(&closeCallbacks->list, g_hash_table_unref); } int diff --git a/src/libxl/libxl_logger.c b/src/libxl/libxl_logger.c index 4692578124..d176c2a7c2 100644 --- a/src/libxl/libxl_logger.c +++ b/src/libxl/libxl_logger.c @@ -166,7 +166,7 @@ libxlLoggerFree(libxlLogger *logger) xentoollog_logger *xtl_logger =3D (xentoollog_logger*)logger; if (logger->defaultLogFile) VIR_FORCE_FCLOSE(logger->defaultLogFile); - virHashFree(logger->files); + g_clear_pointer(&logger->files, g_hash_table_unref); xtl_logger_destroy(xtl_logger); } diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index faca4a2485..cf33d9732b 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -89,7 +89,7 @@ virLockDaemonFree(virLockDaemon *lockd) g_mutex_clear(&lockd->lock); virObjectUnref(lockd->dmn); - virHashFree(lockd->lockspaces); + g_clear_pointer(&lockd->lockspaces, g_hash_table_unref); virLockSpaceFree(lockd->defaultLockspace); g_free(lockd); diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcp= snoop.c index b0297f0741..386e7640c2 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -2080,13 +2080,13 @@ virNWFilterDHCPSnoopShutdown(void) virNWFilterSnoopLock(); virNWFilterSnoopLeaseFileClose(); - virHashFree(virNWFilterSnoopState.ifnameToKey); - virHashFree(virNWFilterSnoopState.snoopReqs); + g_clear_pointer(&virNWFilterSnoopState.ifnameToKey, g_hash_table_unref= ); + g_clear_pointer(&virNWFilterSnoopState.snoopReqs, g_hash_table_unref); virNWFilterSnoopUnlock(); virNWFilterSnoopActiveLock(); - virHashFree(virNWFilterSnoopState.active); + g_clear_pointer(&virNWFilterSnoopState.active, g_hash_table_unref); virNWFilterSnoopActiveUnlock(); } diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter= _gentech_driver.c index ea1f4f4092..20ecd299bf 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -121,7 +121,7 @@ virNWFilterRuleInstFree(virNWFilterRuleInst *inst) if (!inst) return; - virHashFree(inst->vars); + g_clear_pointer(&inst->vars, g_hash_table_unref); g_free(inst); } diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_le= arnipaddr.c index 2177c5540b..fb552bd1e6 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -805,9 +805,6 @@ virNWFilterLearnShutdown(void) virNWFilterLearnThreadsTerminate(false); - virHashFree(pendingLearnReq); - pendingLearnReq =3D NULL; - - virHashFree(ifaceLockMap); - ifaceLockMap =3D NULL; + g_clear_pointer(&pendingLearnReq, g_hash_table_unref); + g_clear_pointer(&ifaceLockMap, g_hash_table_unref); } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3dfc79f61e..c79a7570de 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1701,7 +1701,7 @@ qemuDomainObjPrivateFree(void *data) g_clear_pointer(&priv->migSecinfo, qemuDomainSecretInfoFree); qemuDomainMasterKeyFree(priv); - virHashFree(priv->blockjobs); + g_clear_pointer(&priv->blockjobs, g_hash_table_unref); /* This should never be non-NULL if we get here, but just in case... */ if (priv->eventThread) { diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4fcd6190d1..00a621d9f8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1084,7 +1084,7 @@ qemuStateCleanup(void) virPortAllocatorRangeFree(qemu_driver->migrationPorts); virPortAllocatorRangeFree(qemu_driver->webSocketPorts); virPortAllocatorRangeFree(qemu_driver->remotePorts); - virHashFree(qemu_driver->sharedDevices); + g_clear_pointer(&qemu_driver->sharedDevices, g_hash_table_unref); virObjectUnref(qemu_driver->hostdevMgr); virObjectUnref(qemu_driver->securityManager); virObjectUnref(qemu_driver->domainEventState); diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c index 444fe3dbe7..c946e4a92a 100644 --- a/src/rpc/virnetdaemon.c +++ b/src/rpc/virnetdaemon.c @@ -110,7 +110,7 @@ virNetDaemonDispose(void *obj) VIR_FORCE_CLOSE(dmn->autoShutdownInhibitFd); g_free(dmn->stateStopThread); - virHashFree(dmn->servers); + g_clear_pointer(&dmn->servers, g_hash_table_unref); virJSONValueFree(dmn->srvObject); } diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index 5682d2bb9d..0952431064 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -692,7 +692,7 @@ virSecuritySELinuxLXCInitialize(virSecurityManager *mgr) VIR_FREE(data->domain_context); VIR_FREE(data->file_context); VIR_FREE(data->content_context); - virHashFree(data->mcs); + g_clear_pointer(&data->mcs, g_hash_table_unref); return -1; } @@ -764,7 +764,7 @@ virSecuritySELinuxQEMUInitialize(virSecurityManager *mg= r) VIR_FREE(data->alt_domain_context); VIR_FREE(data->file_context); VIR_FREE(data->content_context); - virHashFree(data->mcs); + g_clear_pointer(&data->mcs, g_hash_table_unref); return -1; } @@ -1030,7 +1030,7 @@ virSecuritySELinuxDriverClose(virSecurityManager *mgr) if (data->label_handle) selabel_close(data->label_handle); - virHashFree(data->mcs); + g_clear_pointer(&data->mcs, g_hash_table_unref); VIR_FREE(data->domain_context); VIR_FREE(data->alt_domain_context); diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c index 64348dc1e6..c140f9d5ea 100644 --- a/src/util/virfilecache.c +++ b/src/util/virfilecache.c @@ -77,7 +77,7 @@ virFileCacheDispose(void *obj) g_free(cache->dir); g_free(cache->suffix); - virHashFree(cache->table); + g_clear_pointer(&cache->table, g_hash_table_unref); virFileCachePrivFree(cache); } diff --git a/src/util/virhash.c b/src/util/virhash.c index a9996c9fc0..cc6053f28d 100644 --- a/src/util/virhash.c +++ b/src/util/virhash.c @@ -112,7 +112,7 @@ virHashAtomicDispose(void *obj) { virHashAtomic *hash =3D obj; - virHashFree(hash->hash); + g_clear_pointer(&hash->hash, g_hash_table_unref); } diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c index 46bd922f35..a7f1c2324f 100644 --- a/src/util/virlockspace.c +++ b/src/util/virlockspace.c @@ -477,7 +477,7 @@ void virLockSpaceFree(virLockSpace *lockspace) if (!lockspace) return; - virHashFree(lockspace->resources); + g_clear_pointer(&lockspace->resources, g_hash_table_unref); g_free(lockspace->dir); virMutexDestroy(&lockspace->lock); g_free(lockspace); diff --git a/src/util/virmacmap.c b/src/util/virmacmap.c index fb16062cd1..0b7b758c6d 100644 --- a/src/util/virmacmap.c +++ b/src/util/virmacmap.c @@ -62,7 +62,7 @@ virMacMapDispose(void *obj) while (g_hash_table_iter_next(&htitr, NULL, &value)) g_slist_free_full(value, g_free); - virHashFree(mgr->macs); + g_clear_pointer(&mgr->macs, g_hash_table_unref); } diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 99c92b6f52..a86d4c6bb9 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -1108,7 +1108,7 @@ virSystemdActivationFree(virSystemdActivation *act) if (!act) return; - virHashFree(act->fds); + g_clear_pointer(&act->fds, g_hash_table_unref); g_free(act); } diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewallt= est.c index 315afddca0..857214dde5 100644 --- a/tests/nwfilterxml2firewalltest.c +++ b/tests/nwfilterxml2firewalltest.c @@ -166,7 +166,7 @@ virNWFilterRuleInstFree(virNWFilterRuleInst *inst) if (!inst) return; - virHashFree(inst->vars); + g_clear_pointer(&inst->vars, g_hash_table_unref); g_free(inst); } diff --git a/tests/qemusecuritymock.c b/tests/qemusecuritymock.c index f092383b62..778b0561ac 100644 --- a/tests/qemusecuritymock.c +++ b/tests/qemusecuritymock.c @@ -502,10 +502,9 @@ void freePaths(void) virMutexLock(&m); init_hash(); - virHashFree(selinux_paths); - virHashFree(chown_paths); - virHashFree(xattr_paths); - selinux_paths =3D chown_paths =3D xattr_paths =3D NULL; + g_clear_pointer(&selinux_paths, g_hash_table_unref); + g_clear_pointer(&chown_paths, g_hash_table_unref); + g_clear_pointer(&xattr_paths, g_hash_table_unref); virMutexUnlock(&m); } --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282823; cv=none; d=zohomail.com; s=zohoarc; b=eyiQzX5SmSx0qUhY1PGKFtSZbD4U0f325RRFzl7qI/88VZIn3I7W7R9diS7dpy6xl8BM4EeHkCSHPGJiuK1BaVscfCEGH/OX9ShnxK61i1cPY0wmsIgluUoVZC+Eb5MT+4Bk/QxdZpRG//PMH/WZ2I2LgncIag54ugDB3k+vcPk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282823; h=Content-Type:Content-Transfer-Encoding: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=5BdL6XqU2pIt/kycConbeqt+GEe3jQXPiWS98UdfftY=; b=ZCOEzYo/hQxYoUVfNV5cLIt6WREsnxiXTXHLOkAIHy5qv8rjGeTgxwKKQay0T+EVGmk1mA43h2ClR4PJpmW8fiR8ygH/Qsuca+Gg1ais42RfnUcKulWR1XYt3P6PC3qpJ/u8vwzUuQ503LaI+N7FbzXo+GRrnbyDkuTW87i3+dE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638282823973339.9084438854371; Tue, 30 Nov 2021 06:33:43 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-178-nImKxAg8OomknbXa0axVzg-1; Tue, 30 Nov 2021 09:33:38 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 879261014B78; Tue, 30 Nov 2021 14:33:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 69413196E2; Tue, 30 Nov 2021 14:33:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 36F314A70A; Tue, 30 Nov 2021 14:33:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXOfo022956 for ; Tue, 30 Nov 2021 09:33:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8169C6107E; Tue, 30 Nov 2021 14:33:24 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF31360C0F for ; Tue, 30 Nov 2021 14:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282823; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=5BdL6XqU2pIt/kycConbeqt+GEe3jQXPiWS98UdfftY=; b=R8b/djc1RfM6uIX3Z0/crqvYbV9t8CZLiH0kZRIUd0EQ5+nqGrzOJa4h6h3gVbDlyxo2bU XgYcEXWxyja4yfTwqyVvauDHAvtzh8kyHFOHcxzdunIxDSAyUHKgbQF5tjPPgS6xYvxH1Z RnXdM5IXMM8IQvjsBY8c4nnEbXABTkk= X-MC-Unique: nImKxAg8OomknbXa0axVzg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 22/23] util: virhash: Remove 'virHashFree' Date: Tue, 30 Nov 2021 15:32:06 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282824955100001 Content-Type: text/plain; charset="utf-8" The code was converted to stop using this function. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko Reviewed-by: Martin Kletzander --- src/libvirt_private.syms | 1 - src/util/virhash.c | 19 ------------------- src/util/virhash.h | 1 - 3 files changed, 21 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index b98cb0f66d..dbdc812d0a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2372,7 +2372,6 @@ virHashEqual; virHashForEach; virHashForEachSafe; virHashForEachSorted; -virHashFree; virHashGetItems; virHashHasEntry; virHashLookup; diff --git a/src/util/virhash.c b/src/util/virhash.c index cc6053f28d..ce954e86ec 100644 --- a/src/util/virhash.c +++ b/src/util/virhash.c @@ -116,25 +116,6 @@ virHashAtomicDispose(void *obj) } -/** - * virHashFree: - * @table: the hash table - * - * Free the hash @table and its contents. The userdata is - * deallocated with function provided at creation time. - * - * Deprecated: consider using g_hash_table_unref instead - */ -void -virHashFree(GHashTable *table) -{ - if (table =3D=3D NULL) - return; - - g_hash_table_unref(table); -} - - /** * virHashAddEntry: * @table: the hash table diff --git a/src/util/virhash.h b/src/util/virhash.h index 426d835cfc..fcab8454bd 100644 --- a/src/util/virhash.h +++ b/src/util/virhash.h @@ -52,7 +52,6 @@ typedef int (*virHashSearcher) (const void *payload, cons= t char *name, */ GHashTable *virHashNew(virHashDataFree dataFree) G_GNUC_WARN_UNUSED_RESULT; virHashAtomic *virHashAtomicNew(virHashDataFree dataFree); -void virHashFree(GHashTable *table); ssize_t virHashSize(GHashTable *table); /* --=20 2.31.1 From nobody Sun May 5 10:32:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1638282820; cv=none; d=zohomail.com; s=zohoarc; b=WQSHyIFXzbp7ZOBNzmV7YepG+6Q8zXtfqj23E4d+SbrKOKLnndKIkgb+k64yEaem3iaKdOn7t3tcnIanvQJEPUOk/qqQCPdJG4fhP1uwLhmEf+o4U1y2+iHtrDwV25DM0cX1aXd2b5ZGwz0+cGDJ+8l73okxOsvp3bs6V0BCN8E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1638282820; h=Content-Type:Content-Transfer-Encoding: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=EkbuKYPUbttMxE3o03AMzl2QC02VYSkS024zKqFlJi8=; b=XSSOm3/xV14sSfrMsQjtbdc5w66BTxBsSSIg3kP0unwvEQCmrFY/mq33+uq/X3/C2RCuJAyR/IlDRBo5bw6gAY3Q/fZTD6k+y9vVP7J0E8jFNDPnSG0RmeqlfSvVjGhH7pL675DQ29eANPmRF5YisNkY9saiPE1cZp6pxbE+GFQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1638282820983631.6223079144678; Tue, 30 Nov 2021 06:33:40 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-374-rO7l8t7XN5SzAr5qoA5pzg-1; Tue, 30 Nov 2021 09:33:36 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3776B1015206; Tue, 30 Nov 2021 14:33:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A1CE6060F; Tue, 30 Nov 2021 14:33:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DD9041806D2C; Tue, 30 Nov 2021 14:33:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AUEXPT3022966 for ; Tue, 30 Nov 2021 09:33:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8E2B060CA1; Tue, 30 Nov 2021 14:33:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCC3D60C81 for ; Tue, 30 Nov 2021 14:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638282819; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=EkbuKYPUbttMxE3o03AMzl2QC02VYSkS024zKqFlJi8=; b=f4wQTnlBCJRTnjtT8Ib2AJY0UnNgTepceIX8s+4D8nb64+HPwNWH0D8Ed5gNh3Nf0FXIHe p6wuOzCnxVtI826bNbIO3rp1pNVvNZjpH4Tybfdu3zAL9DeayIKjGKXocIpWAnWQuOPBxM LyjxcVHC9Gi2qUK7aRHhluyUF3ftF68= X-MC-Unique: rO7l8t7XN5SzAr5qoA5pzg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 23/23] util: virhash: Replace 'virHashDataFree' by 'GDestroyNotify' Date: Tue, 30 Nov 2021 15:32:07 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1638282821891100001 Content-Type: text/plain; charset="utf-8" We pass through to glib's hash table functions so we can also use glibs function prototype definition. Signed-off-by: Peter Krempa Reviewed-by: Martin Kletzander --- src/qemu/qemu_monitor_json.c | 2 +- src/util/virhash.c | 4 ++-- src/util/virhash.h | 12 ++---------- src/util/virobject.c | 4 ++-- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 56f0b22b2a..c10ea583fd 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2830,7 +2830,7 @@ qemuMonitorJSONBlockGetNamedNodeDataJSON(virJSONValue= *nodes) { g_autoptr(GHashTable) ret =3D NULL; - ret =3D virHashNew((virHashDataFree) qemuMonitorJSONBlockNamedNodeData= Free); + ret =3D virHashNew((GDestroyNotify) qemuMonitorJSONBlockNamedNodeDataF= ree); if (virJSONValueArrayForeachSteal(nodes, qemuMonitorJSONBlockGetNamedNodeData= Worker, diff --git a/src/util/virhash.c b/src/util/virhash.c index ce954e86ec..9fcef621fd 100644 --- a/src/util/virhash.c +++ b/src/util/virhash.c @@ -83,7 +83,7 @@ virHashTableStringKey(const void *vkey) * Returns the newly created object. */ GHashTable * -virHashNew(virHashDataFree dataFree) +virHashNew(GDestroyNotify dataFree) { ignore_value(virHashTableSeedInitialize()); @@ -92,7 +92,7 @@ virHashNew(virHashDataFree dataFree) virHashAtomic * -virHashAtomicNew(virHashDataFree dataFree) +virHashAtomicNew(GDestroyNotify dataFree) { virHashAtomic *hash; diff --git a/src/util/virhash.h b/src/util/virhash.h index fcab8454bd..8a6b8a7d37 100644 --- a/src/util/virhash.h +++ b/src/util/virhash.h @@ -15,14 +15,6 @@ typedef struct _virHashAtomic virHashAtomic; * function types: */ -/** - * virHashDataFree: - * @payload: the data in the hash - * - * Callback to free data from a hash. - */ -typedef void (*virHashDataFree) (void *payload); - /** * virHashIterator: * @payload: the data in the hash @@ -50,8 +42,8 @@ typedef int (*virHashSearcher) (const void *payload, cons= t char *name, /* * Constructor and destructor. */ -GHashTable *virHashNew(virHashDataFree dataFree) G_GNUC_WARN_UNUSED_RESULT; -virHashAtomic *virHashAtomicNew(virHashDataFree dataFree); +GHashTable *virHashNew(GDestroyNotify dataFree) G_GNUC_WARN_UNUSED_RESULT; +virHashAtomic *virHashAtomicNew(GDestroyNotify dataFree); ssize_t virHashSize(GHashTable *table); /* diff --git a/src/util/virobject.c b/src/util/virobject.c index 3412985b79..588b41802c 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -604,8 +604,8 @@ void virObjectFreeCallback(void *opaque) * @name: ignored, name of the hash key being deleted * * Provides identical functionality to virObjectUnref, - * but with the signature matching the virHashDataFree - * typedef. + * but with the signature matching the GDestroyNotify + * typedef used with hash tables. */ void virObjectFreeHashData(void *opaque) --=20 2.31.1