From nobody Mon Feb 9 10:50:02 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=1667314993; cv=none; d=zohomail.com; s=zohoarc; b=KJAVKZ5iGUhy+ZsiKcKa7l5qF9IbQDcCxro1H8PY+wKKHbPQCm+tEQuts0o8J83JM1rvxqej/7oSDm9v2D3AlG94bzhrVJ+KQ+735rDZVB9FwIhpKJaXjPCtZUH8G5ckDWZXwcEVXQavnf+szSy6/c1crsd7uHCEGJJrsScrigE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667314993; 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=m5JL/nU1kUs9gCxZlqdqBE2TNXq/+XjKWXXIgx0Hwak=; b=nEVWgzq6caaBgPtLHyv2twPTt3X+Q7UeIDKeb8nXVwL/JuEtsAnQ7gg7GbdIiu0K1kj1S+z3VPpd2NoyXlZ2aTE4fAGQNk0ceD1kwguUyTep4nPxyNuTLMZXCtPRGqCgIwyjQ+SXE5Lv4LBQZm/KLBgYGJLEEhqv0m6nGCMByOU= 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 1667314993774223.8248610549108; Tue, 1 Nov 2022 08:03:13 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-138-8h5B8pUyO0CwvHkFsAJ5JQ-1; Tue, 01 Nov 2022 11:03:08 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E6417101E153; Tue, 1 Nov 2022 15:03:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE0924B400F; Tue, 1 Nov 2022 15:03:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BF42719465B3; Tue, 1 Nov 2022 15:03:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 812E41946594 for ; Tue, 1 Nov 2022 15:03:03 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 65EC82166B2D; Tue, 1 Nov 2022 15:03:03 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id AF8C32166BB6 for ; Tue, 1 Nov 2022 15:03:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314991; 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=m5JL/nU1kUs9gCxZlqdqBE2TNXq/+XjKWXXIgx0Hwak=; b=SKwzDm7uduSUD76TbjR1iegjvAi6dnH2Yw/xPHrHqp9PoGmPnnkaSsTiXOKITDzj8CL92c FgzNgIct2Da708/Ee07mo3U8UYJc5zFmXA7ytT+e2pIInZ0q7xJ3z3WkOmAyvGN2dtO3BL qgqFwDWmAZUReZhmyoL9wY5HQfrCqNU= X-MC-Unique: 8h5B8pUyO0CwvHkFsAJ5JQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/11] conf: domain: Refactor cleanup in virSysinfoParseXML Date: Tue, 1 Nov 2022 16:02:24 +0100 Message-Id: <3e05e88ac14aa2592ae60fbc86db762b489a327a.1667314911.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1667314994129100001 Content-Type: text/plain; charset="utf-8" Use automatic pointer freeing to remove the 'error' label. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b9494500e2..71997e586a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12450,7 +12450,7 @@ virSysinfoParseXML(xmlNodePtr node, bool uuid_generated) { VIR_XPATH_NODE_AUTORESTORE(ctxt) - virSysinfoDef *def; + g_autoptr(virSysinfoDef) def =3D g_new0(virSysinfoDef, 1); ctxt->node =3D node; @@ -12460,32 +12460,26 @@ virSysinfoParseXML(xmlNodePtr node, return NULL; } - def =3D g_new0(virSysinfoDef, 1); - if (virXMLPropEnum(node, "type", virSysinfoTypeFromString, VIR_XML_PROP_REQUIRED, &def->type) < 0) - goto error; + return NULL; switch (def->type) { case VIR_SYSINFO_SMBIOS: if (virSysinfoParseSMBIOSDef(def, ctxt, domUUID, uuid_generated) <= 0) - goto error; + return NULL; break; case VIR_SYSINFO_FWCFG: if (virSysinfoParseFWCfgDef(def, node, ctxt) < 0) - goto error; + return NULL; break; case VIR_SYSINFO_LAST: break; } - return def; - - error: - virSysinfoDefFree(def); - return NULL; + return g_steal_pointer(&def); } unsigned int --=20 2.37.3