From nobody Mon Feb 9 23:39:03 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=1620650960; cv=none; d=zohomail.com; s=zohoarc; b=AelgzeHEKNNWOFlZNZ7ARzSPv0s3eBCmrVatbRY2dcjFFOYnrJiPUpMVbtgGkk60ZL1nGrZwfVha9DTU4uqmrfIybe1ZQIdVYLCOEOauUwdF4P8c39wdtYwtj+elaeCKihMH0GglMr0Ur3ZXtxjBxdDVud0EMR+4Jx7Yex2tFFs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620650960; h=Content-Type:Content-Transfer-Encoding:Cc: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=tcba9n9ng4qsHbgitZ+eKsRL6LVpHOeup60eX4tTVDE=; b=jAmSILgE0Km9Mkb13FOi1/J3HqIED7BwApJS9Pr0sr6LMDldUHjLVPqQF5u6fj6e3VsHKC9MPtpEMJp14Ng9aGZfOYsHwy1ROgHare7KA1LNbxCrTJTmTsV6cpMzFL5B+iVasY8myfSWF/cdfc7g/aWOgL2uEAyumv+E4hNUaVg= 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) header.from= 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 1620650960034558.8705762174278; Mon, 10 May 2021 05:49:20 -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-58-QGFhycd4Nqua-QNzHhjXjA-1; Mon, 10 May 2021 08:49:15 -0400 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 1E6D8107ACED; Mon, 10 May 2021 12:49: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 F24675D9F0; Mon, 10 May 2021 12:49:10 +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 BE6301801028; Mon, 10 May 2021 12:49:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14ACmuNq005682 for ; Mon, 10 May 2021 08:48:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4C4871E6; Mon, 10 May 2021 12:48:56 +0000 (UTC) Received: from work.redhat.com (ovpn-113-46.ams2.redhat.com [10.36.113.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87CDB2C6FB; Mon, 10 May 2021 12:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620650958; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=tcba9n9ng4qsHbgitZ+eKsRL6LVpHOeup60eX4tTVDE=; b=X3tNMXTg+zq3z2tn/t7aAS639iardyY1zbKoLhPg+xD+y9+D6Rr/uSNPy31QMxyDnp0WdT P6S85ban+rJOjI8OGjak4IETDlpOfcaRYioUT+o29O10C5Ww0vbijAAazxPHYG+RO2aw0C DTazSc6slRNIQuHd886+HJ3x7CQJjRw= X-MC-Unique: QGFhycd4Nqua-QNzHhjXjA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] virNodeDevCapsDefParseXML: Use g_autoptr Date: Mon, 10 May 2021 14:48:40 +0200 Message-Id: <20210510124841.123066-10-twiederh@redhat.com> In-Reply-To: <20210510124841.123066-1-twiederh@redhat.com> References: <20210510124841.123066-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/conf/node_device_conf.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index b3d5bc1515..04014f75dc 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1971,14 +1971,12 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, int create, const char *virt_type) { - virNodeDevCapsDef *caps; + g_autoptr(virNodeDevCapsDef) caps =3D g_new0(virNodeDevCapsDef, 1); int ret =3D -1; =20 - caps =3D g_new0(virNodeDevCapsDef, 1); - if (virXMLPropEnum(node, "type", virNodeDevCapTypeFromString, VIR_XML_PROP_REQUIRED, &caps->data.type) < 0) - goto error; + return NULL; =20 switch (caps->data.type) { case VIR_NODE_DEV_CAP_SYSTEM: @@ -2050,12 +2048,9 @@ virNodeDevCapsDefParseXML(xmlXPathContextPtr ctxt, } =20 if (ret < 0) - goto error; - return caps; + return NULL; =20 - error: - virNodeDevCapsDefFree(caps); - return NULL; + return g_steal_pointer(&caps); } =20 =20 --=20 2.26.3