From nobody Sun Feb 8 18:09:11 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=1630788420; cv=none; d=zohomail.com; s=zohoarc; b=NkKG/MUgoQUZaV19yWoDlDNNROv3zsvEtM+QCNd9s5cp1cndcyqmR6LRr9I/N2yr+uxDq7Aggq7ZzhUPIWI/5D5rITsWLpvJ90XMHRKxaSUoxoSazBMX1EiYoT+HxSoKpggu0Dtom7A3A9DYcpwxca9uXLWnfNpzimgg2lSBV4A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630788420; 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=/6GCfwG4IqdMn7D+xX4mQ+oCv7PZcnyyY9iB+neaT0M=; b=FKu17QhSMvWGfgWyOjayBDGSJnNSznm8MANkj46vzCgF5SdBKSOHb4IFTYCwCnR3QmdZuRPMB2rDYuDzFG1KxGvaEsf/QHqHiFNUdm7GRNQ3CCeHBOd3IBxqlaAlaPyPkeKmPK2DWXrprYvS0AMB11gKnf+c07GAaCk7/nfI5mQ= 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 1630788420605355.95856849405527; Sat, 4 Sep 2021 13:47:00 -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-170-aQmiNE-pMgSgZLkDKdvP9w-1; Sat, 04 Sep 2021 16:46:57 -0400 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 2DFEF18460E3; Sat, 4 Sep 2021 20:46:53 +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 10AF95C1CF; Sat, 4 Sep 2021 20:46:53 +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 D73D244A5F; Sat, 4 Sep 2021 20:46:52 +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 184KibJZ008828 for ; Sat, 4 Sep 2021 16:44:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9C0372619D; Sat, 4 Sep 2021 20:44:37 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25D3B1F4 for ; Sat, 4 Sep 2021 20:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630788419; 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=/6GCfwG4IqdMn7D+xX4mQ+oCv7PZcnyyY9iB+neaT0M=; b=ZwzKHBUviVlhl0sSWjGhQKX+Ato8zm20HO/o2nQ1H5XeSjMgDLjubcaxB2sQRh13g1wQBz wx2f/GpHgRvu8Kh8gOpmo6qtPnCKbRdcA6QeTAEb5gLO82rT+U1rwX4MMuG64wvfJip+tY EBXs4jDpY6ErACJ/B9bopHmUFOIu2Q0= X-MC-Unique: aQmiNE-pMgSgZLkDKdvP9w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 12/24] tests: use g_autoptr instead of virJSONValueFree Date: Sat, 4 Sep 2021 22:44:10 +0200 Message-Id: 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.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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1630788422749100005 Signed-off-by: J=C3=A1n Tomko --- tests/qemucapsprobemock.c | 3 +-- tests/qemucommandutiltest.c | 3 +-- tests/qemumonitorjsontest.c | 12 ++++-------- tests/virnetdaemontest.c | 3 +-- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c index 00670101ce..27539d04a1 100644 --- a/tests/qemucapsprobemock.c +++ b/tests/qemucapsprobemock.c @@ -87,7 +87,7 @@ qemuMonitorJSONIOProcessLine(qemuMonitor *mon, const char *line, qemuMonitorMessage *msg) { - virJSONValue *value =3D NULL; + g_autoptr(virJSONValue) value =3D NULL; g_autofree char *json =3D NULL; int ret; =20 @@ -115,6 +115,5 @@ qemuMonitorJSONIOProcessLine(qemuMonitor *mon, } =20 cleanup: - virJSONValueFree(value); return ret; } diff --git a/tests/qemucommandutiltest.c b/tests/qemucommandutiltest.c index 6b5e477849..e1cab0be90 100644 --- a/tests/qemucommandutiltest.c +++ b/tests/qemucommandutiltest.c @@ -37,7 +37,7 @@ static int testQemuCommandBuildFromJSON(const void *opaque) { const testQemuCommandBuildObjectFromJSONData *data =3D opaque; - virJSONValue *val =3D NULL; + g_autoptr(virJSONValue) val =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; g_autofree char *result =3D NULL; int ret =3D -1; @@ -65,7 +65,6 @@ testQemuCommandBuildFromJSON(const void *opaque) =20 ret =3D 0; cleanup: - virJSONValueFree(val); return ret; } =20 diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index c64c5c6b6f..542b35850e 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2507,8 +2507,8 @@ testBlockNodeNameDetect(const void *opaque) const char *pathprefix =3D "qemumonitorjsondata/qemumonitorjson-nodena= me-"; g_autofree char *resultFile =3D NULL; g_autofree char *actual =3D NULL; - virJSONValue *namedNodesJson =3D NULL; - virJSONValue *blockstatsJson =3D NULL; + g_autoptr(virJSONValue) namedNodesJson =3D NULL; + g_autoptr(virJSONValue) blockstatsJson =3D NULL; GHashTable *nodedata =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; int ret =3D -1; @@ -2541,8 +2541,6 @@ testBlockNodeNameDetect(const void *opaque) =20 cleanup: virHashFree(nodedata); - virJSONValueFree(namedNodesJson); - virJSONValueFree(blockstatsJson); =20 return ret; } @@ -2584,7 +2582,7 @@ testQAPISchemaValidate(const void *opaque) const struct testQAPISchemaData *data =3D opaque; g_auto(virBuffer) debug =3D VIR_BUFFER_INITIALIZER; virJSONValue *schemaroot; - virJSONValue *json =3D NULL; + g_autoptr(virJSONValue) json =3D NULL; int ret =3D -1; =20 if (virQEMUQAPISchemaPathGet(data->query, data->schema, &schemaroot) <= 0) @@ -2610,7 +2608,6 @@ testQAPISchemaValidate(const void *opaque) =20 =20 cleanup: - virJSONValueFree(json); return ret; } =20 @@ -2927,7 +2924,7 @@ mymain(void) virQEMUDriver driver; testQemuMonitorJSONSimpleFuncData simpleFunc; struct testQAPISchemaData qapiData; - virJSONValue *metaschema =3D NULL; + g_autoptr(virJSONValue) metaschema =3D NULL; g_autofree char *metaschemastr =3D NULL; =20 if (qemuTestDriverInit(&driver) < 0) @@ -3220,7 +3217,6 @@ mymain(void) DO_TEST(qemuMonitorJSONGetCPUModelBaseline); =20 cleanup: - virJSONValueFree(metaschema); virHashFree(qapiData.schema); qemuTestDriverFree(&driver); return (ret =3D=3D 0) ? EXIT_SUCCESS : EXIT_FAILURE; diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c index 2522a4c8ea..70af1480df 100644 --- a/tests/virnetdaemontest.c +++ b/tests/virnetdaemontest.c @@ -188,7 +188,7 @@ static char *testGenerateJSON(const char *server_name) { virNetDaemon *dmn =3D NULL; virNetServer *srv =3D NULL; - virJSONValue *json =3D NULL; + g_autoptr(virJSONValue) json =3D NULL; char *jsonstr =3D NULL; bool has_ipv4, has_ipv6; =20 @@ -226,7 +226,6 @@ static char *testGenerateJSON(const char *server_name) virNetServerClose(srv); virObjectUnref(srv); virObjectUnref(dmn); - virJSONValueFree(json); if (!jsonstr) virDispatchError(NULL); return jsonstr; --=20 2.31.1