From nobody Mon Feb 9 03:46:36 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=1629203218; cv=none; d=zohomail.com; s=zohoarc; b=erKtOyFYRZz05fUEcXnI1/8uzPOMz/LPPGprUUNNTzrDfJYA3HAmF2bpjvGXzNDgVCx3MibO+5lZjby5ahaHQIHLOFMxG11D7listiHBxpbeZbiQLWU3ZJKBmel7vXhaOOsTONb+bMefjMQhx/x1agWdkmsQ9Wu9p7PavdPNFVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629203218; 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=niKplBZ6ozsnRy/XV3jINEI/mBfAwSE6CQiiO1OHfC8=; b=clQiLq3bx+q8Mcc7inC4l5wabKxf7VVxs3ZKqCKC5VnwKdvzRz8AWtQxmHaIFt3adpvq/vqLbmTX5LLvumJCnYw0vKUYzR3d304BCYnhrjdx6kQ102F/QROWflldE+Tc3xEKKkQHYxWI8iB5qoupKDMOKaQb3wt9W4OZgfgDOkM= 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 1629203218537962.3497534316954; Tue, 17 Aug 2021 05:26:58 -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-262-3bUpUEL2Noi-vPUWcnIiJg-1; Tue, 17 Aug 2021 08:26:55 -0400 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 3C4301019629; Tue, 17 Aug 2021 12:26:50 +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 161A21045D1C; Tue, 17 Aug 2021 12:26:50 +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 D79FC4A700; Tue, 17 Aug 2021 12:26:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17HCPgPG018165 for ; Tue, 17 Aug 2021 08:25:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id EE55C60871; Tue, 17 Aug 2021 12:25:42 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.53]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78EF360854 for ; Tue, 17 Aug 2021 12:25:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629203217; 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=niKplBZ6ozsnRy/XV3jINEI/mBfAwSE6CQiiO1OHfC8=; b=TgS4K+Wyr8fOg3OCaRhYb7MxDz1kHs329pVNninPSjP8G+FePrFsJRSE1adGCkf26a16SC JbHlyozZlrUPmBk56Nlnp0p9U9tKF0aNPa7Jf7EhZe6a9eqN5x+fHNLKV8r38GW0XE28Dj XURWIOeuXhOB4yI+O1bAhOZF7HDBSxo= X-MC-Unique: 3bUpUEL2Noi-vPUWcnIiJg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 5/6] Use g_autofree in affected functions Date: Tue, 17 Aug 2021 14:25:32 +0200 Message-Id: <3a8f3b5787d249db2447838b2338e35ff939c444.1629203014.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629203219554100001 Add g_autofree to functions changed in previous commits doing g_auto cleanup for libxml2-related variables, where it could lead to removal of a label. Signed-off-by: J=C3=A1n Tomko --- src/conf/virstorageobj.c | 3 +-- tests/cputest.c | 9 +++------ tests/metadatatest.c | 3 +-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index f8b85494c0..1f6fedba13 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -1641,7 +1641,7 @@ virStoragePoolObjLoadState(virStoragePoolObjList *poo= ls, const char *stateDir, const char *name) { - char *stateFile =3D NULL; + g_autofree char *stateFile =3D NULL; virStoragePoolObj *obj =3D NULL; g_autoptr(xmlDoc) xml =3D NULL; g_autoptr(xmlXPathContext) ctxt =3D NULL; @@ -1686,7 +1686,6 @@ virStoragePoolObjLoadState(virStoragePoolObjList *poo= ls, obj->active =3D true; =20 cleanup: - VIR_FREE(stateFile); return obj; } =20 diff --git a/tests/cputest.c b/tests/cputest.c index d19ded4b40..14606f5864 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -70,7 +70,7 @@ static virQEMUDriver driver; static virCPUDef * cpuTestLoadXML(virArch arch, const char *name) { - char *xml =3D NULL; + g_autofree char *xml =3D NULL; g_autoptr(xmlDoc) doc =3D NULL; g_autoptr(xmlXPathContext) ctxt =3D NULL; virCPUDef *cpu =3D NULL; @@ -84,7 +84,6 @@ cpuTestLoadXML(virArch arch, const char *name) virCPUDefParseXML(ctxt, NULL, VIR_CPU_TYPE_AUTO, &cpu, false); =20 cleanup: - VIR_FREE(xml); return cpu; } =20 @@ -94,10 +93,10 @@ cpuTestLoadMultiXML(virArch arch, const char *name, unsigned int *count) { - char *xml =3D NULL; + g_autofree char *xml =3D NULL; g_autoptr(xmlDoc) doc =3D NULL; g_autoptr(xmlXPathContext) ctxt =3D NULL; - xmlNodePtr *nodes =3D NULL; + g_autofree xmlNodePtr *nodes =3D NULL; virCPUDef **cpus =3D NULL; int n; size_t i; @@ -126,8 +125,6 @@ cpuTestLoadMultiXML(virArch arch, *count =3D n; =20 cleanup: - VIR_FREE(xml); - VIR_FREE(nodes); return cpus; =20 cleanup_cpus: diff --git a/tests/metadatatest.c b/tests/metadatatest.c index 2bcb0a1225..2c560c27c1 100644 --- a/tests/metadatatest.c +++ b/tests/metadatatest.c @@ -60,7 +60,7 @@ getMetadataFromXML(virDomainPtr dom) g_autoptr(xmlXPathContext) ctxt =3D NULL; xmlNodePtr node; =20 - char *xml =3D NULL; + g_autofree char *xml =3D NULL; char *ret =3D NULL; =20 if (!(xml =3D virDomainGetXMLDesc(dom, 0))) @@ -75,7 +75,6 @@ getMetadataFromXML(virDomainPtr dom) ret =3D virXMLNodeToString(node->doc, node); =20 cleanup: - VIR_FREE(xml); =20 return ret; } --=20 2.31.1