From nobody Sun Feb 8 17:03:25 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=1663577737; cv=none; d=zohomail.com; s=zohoarc; b=ah3dfAseyCCKo6APU6LaTUk39liF3XdCWx+xIRFrrCPuf6FAdSZ6TXcCAKPwihjUlwWk0+3b+WqxrnIkLjMswFEZAwsCTNEQ2hl1Hmnc2HuhsbUWhipXQB3HTG6RtoxulTDKWDZFqP8tchPcqQKpzifUcEU29jhquTBqnQT8GKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1663577737; 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=FG8Wn5tEDVIxx1vYDTMOdEYbhcoOeYWgOntBnG+oZg4=; b=lePLFlwikqFdLsVeIMUWvuxklM8MuFhZjx/QwwzyxRt6AAYq9/9qfqKNisZ1I/l0OkXho2OeslR60u0h00PINNgMrRUIH1xyc6HeDgyuPSIr/QCKwSUwps2bx/VNIFD69lz/MPqWNbs7e+TdUAd2v04232g2v6/mM9eK72vi2ZE= 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 1663577737129452.02072172181965; Mon, 19 Sep 2022 01:55:37 -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-466-lxCppqb9O8-mpK2kANk3Tg-1; Mon, 19 Sep 2022 04:55:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 685C7868A3C; Mon, 19 Sep 2022 08:55:27 +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 222181121315; Mon, 19 Sep 2022 08:55:27 +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 055AA1946594; Mon, 19 Sep 2022 08:55:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 94DA61946597 for ; Mon, 19 Sep 2022 08:55:25 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 86AD440C6EC3; Mon, 19 Sep 2022 08:55:25 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id F226240C6EC4 for ; Mon, 19 Sep 2022 08:55:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663577736; 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=FG8Wn5tEDVIxx1vYDTMOdEYbhcoOeYWgOntBnG+oZg4=; b=Gi3nytVOi5K1iBTxkXKdHvchfBEJXT6lcwi8vC1Z9loPOWNGzieIxV0B15nAWpGaJ+SrXA 3Zl1MIVwSZC6SaxQaIKzzlEChspJk4GQ/SALqhr95mfD5npf59axHyV7c9f1XQJXb/bQf0 6wTDRoVU0+7gGVRngBrAmPKBUgoi/jA= X-MC-Unique: lxCppqb9O8-mpK2kANk3Tg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/37] conf: domain: Automatically free 'def' and 'actual' in virDomainNetDefParseXML Date: Mon, 19 Sep 2022 10:54:47 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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.3 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: 1663577739029100009 Content-Type: text/plain; charset="utf-8" Convert the last two variables having inline cleanup to automatic cleanup. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 406c348a00..7f5efa205c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8833,7 +8833,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, xmlXPathContextPtr ctxt, unsigned int flags) { - virDomainNetDef *def; + g_autoptr(virDomainNetDef) def =3D NULL; virDomainHostdevDef *hostdev; xmlNodePtr source_node =3D NULL; xmlNodePtr virtualport_node =3D NULL; @@ -8845,7 +8845,7 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, xmlNodePtr tmpNode; xmlNodePtr mac_node =3D NULL; g_autoptr(GHashTable) filterparams =3D NULL; - virDomainActualNetDef *actual =3D NULL; + g_autoptr(virDomainActualNetDef) actual =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) virDomainChrSourceReconnectDef reconnect =3D {0}; int rv, val; @@ -9571,13 +9571,10 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, if (virNetworkPortOptionsParseXML(ctxt, &def->isolatedPort) < 0) goto error; - cleanup: - virDomainActualNetDefFree(actual); - return def; + return g_steal_pointer(&def); error: - g_clear_pointer(&def, virDomainNetDefFree); - goto cleanup; + return NULL; } static int --=20 2.37.1