From nobody Sun Feb 8 10:03:29 2026 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=1630788726; cv=none; d=zohomail.com; s=zohoarc; b=Eb3FcCOuu2W+7kKUuertVpWt2dQPAQyIi7TYWyf844mPG2/tP0ZI8Zf64344IOtiqAgDkUsjzqZ/RdiTWmUN+jLYcyrDU87uuoV8Hv3ysXsKGwZ9esuHO2Y7WXitdTuix3KGZWL0DGrqeEUS1WifHe86fYjKmVS7jMMxesm9nLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630788726; 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=4Q3iw6mCUCK2zgQ5eWK8foN+dY4k9eIlZA92MvH8jdc=; b=XRMlLos6J4Eos8T/r41Ijd8UhexgiENuWK39/WLT3H8Pr/8iWojHlLgFXjJiDgFv3WicWPLGG2UytoVzYwdXGGLKPPIkhhmFejt41QzwPV9yCvN9QSb46iqiHFnCdpx96OJaRPcu/Ly7HMY8Q2dzgrkxBPWeVYVIIeZ3fU4i67M= 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 1630788726767623.8148823299164; Sat, 4 Sep 2021 13:52:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-470-fUp7y7hPOVmJlmP47pgzjw-1; Sat, 04 Sep 2021 16:51:38 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8F5EE1854E2D; Sat, 4 Sep 2021 20:51:33 +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 5317E6B54B; Sat, 4 Sep 2021 20:51:33 +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 28B13180BAC0; Sat, 4 Sep 2021 20:51:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 184KiftI008873 for ; Sat, 4 Sep 2021 16:44:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id A206B2619D; Sat, 4 Sep 2021 20:44:41 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C15A1F4 for ; Sat, 4 Sep 2021 20:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630788725; 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=4Q3iw6mCUCK2zgQ5eWK8foN+dY4k9eIlZA92MvH8jdc=; b=XSd3aC13ZDgqvq6hOcdT4xzCsBF4/8Hpb6CeAI1gd721Wb7D9WhZ4eE6KqBEhNYy67mMR7 sF/FV6iFa2y+/22rkHjSmpQIMK740PT2BvLKH45c+csI4zihwTbX1bQIZF55v40MnClBJC yaw/gIngp1clsya7LHXGYVHJ65pxCNI= X-MC-Unique: fUp7y7hPOVmJlmP47pgzjw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 17/24] tests: use g_auto instead of virDomainFree Date: Sat, 4 Sep 2021 22:44:15 +0200 Message-Id: <3d34d2e10ed134ecd8f43f708b277353e4256971.1630788206.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.15 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630788728086100001 Signed-off-by: J=C3=A1n Tomko --- tests/domainconftest.c | 3 +-- tests/libxlxml2domconfigtest.c | 3 +-- tests/lxcconf2xmltest.c | 3 +-- tests/openvzutilstest.c | 3 +-- tests/qemuagenttest.c | 3 +-- tests/securityselinuxlabeltest.c | 3 +-- tests/testutils.c | 3 +-- tests/vmx2xmltest.c | 3 +-- tests/xlconfigtest.c | 6 ++---- tests/xmconfigtest.c | 6 ++---- tests/xml2vmxtest.c | 3 +-- 11 files changed, 13 insertions(+), 26 deletions(-) diff --git a/tests/domainconftest.c b/tests/domainconftest.c index 8b77952860..aaf58bcf93 100644 --- a/tests/domainconftest.c +++ b/tests/domainconftest.c @@ -41,7 +41,7 @@ struct testGetFilesystemData { static int testGetFilesystem(const void *opaque) { int ret =3D -1; - virDomainDef *def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; g_autofree char *filename =3D NULL; const struct testGetFilesystemData *data =3D opaque; virDomainFSDef *fsdef; @@ -71,7 +71,6 @@ static int testGetFilesystem(const void *opaque) ret =3D 0; =20 cleanup: - virDomainDefFree(def); return ret; } =20 diff --git a/tests/libxlxml2domconfigtest.c b/tests/libxlxml2domconfigtest.c index 2bc5c26223..015597eb44 100644 --- a/tests/libxlxml2domconfigtest.c +++ b/tests/libxlxml2domconfigtest.c @@ -52,7 +52,7 @@ testCompareXMLToDomConfig(const char *xmlfile, libxl_domain_config expectconfig; xentoollog_logger *log =3D NULL; virPortAllocatorRange *gports =3D NULL; - virDomainDef *vmdef =3D NULL; + g_autoptr(virDomainDef) vmdef =3D NULL; g_autofree char *actualjson =3D NULL; g_autofree char *tempjson =3D NULL; g_autofree char *expectjson =3D NULL; @@ -128,7 +128,6 @@ testCompareXMLToDomConfig(const char *xmlfile, vmdef->graphics[0]->type =3D=3D VIR_DOMAIN_GRAPHICS_TYPE_VNC) virPortAllocatorRelease(vmdef->graphics[0]->data.vnc.port); =20 - virDomainDefFree(vmdef); virPortAllocatorRangeFree(gports); libxl_domain_config_dispose(&actualconfig); libxl_domain_config_dispose(&expectconfig); diff --git a/tests/lxcconf2xmltest.c b/tests/lxcconf2xmltest.c index 99473a0b89..be70671d68 100644 --- a/tests/lxcconf2xmltest.c +++ b/tests/lxcconf2xmltest.c @@ -28,7 +28,7 @@ testCompareXMLToConfigFiles(const char *xmlfile, int ret =3D -1; g_autofree char *config =3D NULL; g_autofree char *actualxml =3D NULL; - virDomainDef *vmdef =3D NULL; + g_autoptr(virDomainDef) vmdef =3D NULL; =20 if (virTestLoadFile(configfile, &config) < 0) goto fail; @@ -51,7 +51,6 @@ testCompareXMLToConfigFiles(const char *xmlfile, ret =3D 0; =20 fail: - virDomainDefFree(vmdef); return ret; } =20 diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c index 10cf307d61..3ebf38f104 100644 --- a/tests/openvzutilstest.c +++ b/tests/openvzutilstest.c @@ -69,7 +69,7 @@ static int testReadNetworkConf(const void *data G_GNUC_UNUSED) { int result =3D -1; - virDomainDef *def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; g_autofree char *actual =3D NULL; const char *expected =3D "\n" @@ -131,7 +131,6 @@ testReadNetworkConf(const void *data G_GNUC_UNUSED) cleanup: virObjectUnref(driver.xmlopt); virObjectUnref(driver.caps); - virDomainDefFree(def); =20 return result; } diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c index a447c93494..10d02bd1b4 100644 --- a/tests/qemuagenttest.c +++ b/tests/qemuagenttest.c @@ -313,7 +313,7 @@ testQemuAgentGetFSInfo(const void *data) { virDomainXMLOption *xmlopt =3D (virDomainXMLOption *)data; qemuMonitorTest *test =3D NULL; - virDomainDef *def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; qemuAgentFSInfo **info =3D NULL; int ret =3D -1, ninfo =3D 0, i; =20 @@ -405,7 +405,6 @@ testQemuAgentGetFSInfo(const void *data) for (i =3D 0; i < ninfo; i++) qemuAgentFSInfoFree(info[i]); VIR_FREE(info); - virDomainDefFree(def); qemuMonitorTestFree(test); return ret; } diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabelt= est.c index 2fb6e0c6b7..2e5941d7ef 100644 --- a/tests/securityselinuxlabeltest.c +++ b/tests/securityselinuxlabeltest.c @@ -278,7 +278,7 @@ testSELinuxLabeling(const void *opaque) testSELinuxFile *files =3D NULL; size_t nfiles =3D 0; size_t i; - virDomainDef *def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; =20 if (testSELinuxLoadFileList(testname, &files, &nfiles) < 0) goto cleanup; @@ -301,7 +301,6 @@ testSELinuxLabeling(const void *opaque) if (testSELinuxDeleteDisks(files, nfiles) < 0) VIR_WARN("unable to fully clean up"); =20 - virDomainDefFree(def); for (i =3D 0; i < nfiles; i++) { VIR_FREE(files[i].file); VIR_FREE(files[i].context); diff --git a/tests/testutils.c b/tests/testutils.c index d98246ec75..7e0d273ed4 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -1009,7 +1009,7 @@ testCompareDomXML2XMLFiles(virCaps *caps G_GNUC_UNUSE= D, g_autofree char *actual =3D NULL; int ret =3D -1; testCompareDomXML2XMLResult result; - virDomainDef *def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; unsigned int parse_flags =3D live ? 0 : VIR_DOMAIN_DEF_PARSE_INACTIVE; unsigned int format_flags =3D VIR_DOMAIN_DEF_FORMAT_SECURE; =20 @@ -1059,7 +1059,6 @@ testCompareDomXML2XMLFiles(virCaps *caps G_GNUC_UNUSE= D, expectResult, result); } =20 - virDomainDefFree(def); return ret; } =20 diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index cd44a84a07..b7f232eb77 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -71,7 +71,7 @@ testCompareFiles(const char *vmx, const char *xml, bool s= hould_fail_parse) int ret =3D -1; g_autofree char *vmxData =3D NULL; g_autofree char *formatted =3D NULL; - virDomainDef *def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; =20 if (virTestLoadFile(vmx, &vmxData) < 0) return -1; @@ -102,7 +102,6 @@ testCompareFiles(const char *vmx, const char *xml, bool= should_fail_parse) ret =3D 0; =20 cleanup: - virDomainDefFree(def); =20 return ret; } diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c index 95ee670b00..6717377982 100644 --- a/tests/xlconfigtest.c +++ b/tests/xlconfigtest.c @@ -69,7 +69,7 @@ testCompareParseXML(const char *xlcfg, const char *xml, b= ool replaceVars) g_autoptr(virConnect) conn =3D NULL; int wrote =3D 4096; int ret =3D -1; - virDomainDef *def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; g_autofree char *replacedXML =3D NULL; =20 gotxlcfgData =3D g_new0(char, wrote); @@ -107,7 +107,6 @@ testCompareParseXML(const char *xlcfg, const char *xml,= bool replaceVars) ret =3D 0; =20 fail: - virDomainDefFree(def); =20 return ret; } @@ -124,7 +123,7 @@ testCompareFormatXML(const char *xlcfg, const char *xml= , bool replaceVars) g_autoptr(virConf) conf =3D NULL; int ret =3D -1; g_autoptr(virConnect) conn =3D NULL; - virDomainDef *def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; g_autofree char *replacedXML =3D NULL; g_autoptr(libxlDriverConfig) cfg =3D libxlDriverConfigGet(driver); =20 @@ -158,7 +157,6 @@ testCompareFormatXML(const char *xlcfg, const char *xml= , bool replaceVars) ret =3D 0; =20 fail: - virDomainDefFree(def); =20 return ret; } diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c index a756f752f8..bd23e5fd5d 100644 --- a/tests/xmconfigtest.c +++ b/tests/xmconfigtest.c @@ -44,7 +44,7 @@ testCompareParseXML(const char *xmcfg, const char *xml) int ret =3D -1; g_autoptr(virConnect) conn =3D NULL; int wrote =3D 4096; - virDomainDef *def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; =20 gotxmcfgData =3D g_new0(char, wrote); =20 @@ -73,7 +73,6 @@ testCompareParseXML(const char *xmcfg, const char *xml) ret =3D 0; =20 fail: - virDomainDefFree(def); =20 return ret; } @@ -85,7 +84,7 @@ testCompareFormatXML(const char *xmcfg, const char *xml) g_autofree char *gotxml =3D NULL; g_autoptr(virConf) conf =3D NULL; int ret =3D -1; - virDomainDef *def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; g_autoptr(libxlDriverConfig) cfg =3D libxlDriverConfigGet(driver); =20 if (virTestLoadFile(xmcfg, &xmcfgData) < 0) @@ -106,7 +105,6 @@ testCompareFormatXML(const char *xmcfg, const char *xml) ret =3D 0; =20 fail: - virDomainDefFree(def); =20 return ret; } diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index cb70f70f4f..8a03237b16 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -72,7 +72,7 @@ testCompareFiles(const char *xml, const char *vmx, int vi= rtualHW_version) { int result =3D -1; g_autofree char *formatted =3D NULL; - virDomainDef *def =3D NULL; + g_autoptr(virDomainDef) def =3D NULL; =20 def =3D virDomainDefParseFile(xml, xmlopt, NULL, VIR_DOMAIN_DEF_PARSE_INACTIVE); @@ -95,7 +95,6 @@ testCompareFiles(const char *xml, const char *vmx, int vi= rtualHW_version) result =3D 0; =20 failure: - virDomainDefFree(def); =20 return result; } --=20 2.31.1