From nobody Sun Feb 8 17:37:16 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; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com 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 1637244162809807.355469628074; Thu, 18 Nov 2021 06:02:42 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-560-uCC4UH54MQ20Nx-B-cKnnA-1; Thu, 18 Nov 2021 09:02:39 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9FE9719253C8; Thu, 18 Nov 2021 14:02:28 +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 80D6260C4A; Thu, 18 Nov 2021 14:02:28 +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 4D77B4EA38; Thu, 18 Nov 2021 14:02:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIE0AOW010932 for ; Thu, 18 Nov 2021 09:00:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8B7232144B23; Thu, 18 Nov 2021 14:00:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 85AE02144B22 for ; Thu, 18 Nov 2021 14:00:10 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 68CA180A0AC for ; Thu, 18 Nov 2021 14:00:10 +0000 (UTC) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-113-k3sCpwj9OKO_-Hyn1TrT0g-1; Thu, 18 Nov 2021 09:00:08 -0500 Received: by mail-qt1-f170.google.com with SMTP id j17so6089094qtx.2 for ; Thu, 18 Nov 2021 06:00:08 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id e7sm1542168qtx.72.2021.11.18.06.00.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:00:07 -0800 (PST) X-MC-Unique: uCC4UH54MQ20Nx-B-cKnnA-1 X-MC-Unique: k3sCpwj9OKO_-Hyn1TrT0g-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mn1iMJkdZnz921TVVcPwix9TlPbpCcBIUEOzg7xwzPY=; b=OcA8/f5x29m7rcvqX+QH8SMEAcb+DVEDPok86i/BowLVVmXrECf6o0+iijx/l8/ZmQ RXuOk1CBBeiaVOHL/K+4e/KTwNSMlt0+zA3acW8oI4oVFqn7kYIPpTEpmOiYfiCln8X/ ghoXLM394DFwSu6yBKN7rXz8LrlN+YzgYVQTxC31WpagKbjbBsX+ACXrJRg5N40nDLDG HHXTNP9PWyZ7UPDE0oIFnYfPHz8NOJUuVIJJW4WdTxZs7Qrb5VLm6XvJsIxQriGaqapb +wFbppnmbfNMPHHTWfccT6JZUa90McYp8ThP40RiNO4tLOFWe6x7gGQI/isHUdAGsJji 7XkA== X-Gm-Message-State: AOAM533UYEqeKm8MFLB3onqX/U6X5q4uQp34QFUbKiGwy8fQldz9COx5 ULLXvDqb+t1qIrJgzoQjbqyywCNR906Svg== X-Google-Smtp-Source: ABdhPJxvSKf8nO1Z83OQGe8M8Y418AdRMAh9nkWxNA93JrXlgp3qLTwlQK0LWbjUnUxCCCWcuBG0wg== X-Received: by 2002:ac8:5cc5:: with SMTP id s5mr26783256qta.97.1637244007980; Thu, 18 Nov 2021 06:00:07 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH 6/7] qemu_process.c: use g_autoptr() in qemuProcessQMPInitMonitor Date: Thu, 18 Nov 2021 10:59:43 -0300 Message-Id: <20211118135944.272979-7-danielhb413@gmail.com> In-Reply-To: <20211118135944.272979-1-danielhb413@gmail.com> References: <20211118135944.272979-1-danielhb413@gmail.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: danielh413@gmail.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.12 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-ZM-MESSAGEID: 1637244207730100003 Content-Type: text/plain; charset="utf-8" The 'xmlopt' parameter can be auto-unref by using g_autoptr(). Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_process.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b6c81dd23a..c355a39e15 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -9257,9 +9257,8 @@ qemuProcessQMPInitMonitor(qemuMonitor *mon) static int qemuProcessQMPConnectMonitor(qemuProcessQMP *proc) { - virDomainXMLOption *xmlopt =3D NULL; + g_autoptr(virDomainXMLOption) xmlopt =3D NULL; virDomainChrSourceDef monConfig; - int ret =3D -1; =20 VIR_DEBUG("proc=3D%p, emulator=3D%s, proc->pid=3D%lld", proc, proc->binary, (long long)proc->pid); @@ -9271,25 +9270,21 @@ qemuProcessQMPConnectMonitor(qemuProcessQMP *proc) if (!(xmlopt =3D virDomainXMLOptionNew(NULL, NULL, NULL, NULL, NULL)) = || !(proc->vm =3D virDomainObjNew(xmlopt)) || !(proc->vm->def =3D virDomainDefNew(xmlopt))) - goto cleanup; + return -1; =20 proc->vm->pid =3D proc->pid; =20 if (!(proc->mon =3D qemuMonitorOpen(proc->vm, &monConfig, true, 0, virEventThreadGetContext(proc->event= Thread), &callbacks, NULL))) - goto cleanup; + return -1; =20 virObjectLock(proc->mon); =20 if (qemuProcessQMPInitMonitor(proc->mon) < 0) - goto cleanup; - - ret =3D 0; + return -1; =20 - cleanup: - virObjectUnref(xmlopt); - return ret; + return 0; } =20 =20 --=20 2.31.1