From nobody Sat Feb 7 08:44: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; 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 1637245264010600.9000621178311; Thu, 18 Nov 2021 06:21:04 -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-600-UpXmovYDPRKwnnaF1GMCUw-1; Thu, 18 Nov 2021 09:21:00 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 29EFFA0CAD; Thu, 18 Nov 2021 14:20:52 +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 CA58169FA3; Thu, 18 Nov 2021 14:20:51 +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 50E171832DD2; Thu, 18 Nov 2021 14:20:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1AIEKm3m013027 for ; Thu, 18 Nov 2021 09:20:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 244AA40CFD11; Thu, 18 Nov 2021 14:20:48 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F6DD40CFD10 for ; Thu, 18 Nov 2021 14:20:48 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 08C68185A7B4 for ; Thu, 18 Nov 2021 14:20:48 +0000 (UTC) Received: from mail-ua1-f52.google.com (mail-ua1-f52.google.com [209.85.222.52]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-418-8Hmm6fmLMEq2YquMKtnVlw-1; Thu, 18 Nov 2021 09:20:46 -0500 Received: by mail-ua1-f52.google.com with SMTP id p37so13941068uae.8 for ; Thu, 18 Nov 2021 06:20:46 -0800 (PST) Received: from rekt.ibmuc.com ([152.250.208.89]) by smtp.gmail.com with ESMTPSA id b8sm1734306vsl.19.2021.11.18.06.20.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 06:20:45 -0800 (PST) X-MC-Unique: UpXmovYDPRKwnnaF1GMCUw-1 X-MC-Unique: 8Hmm6fmLMEq2YquMKtnVlw-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=YUvp8Rx+s2hEbY6E64S8pU5kBJYGl0pZ3TKQR2near1fGyBYDu3LtBqqdNXXg/J3mh st16rRk+Qusm4PItyZDR9N/apUR9+Aig+Xcv8xSmCbvIrsmsD0P1rtbPQVPGPSmSygUr gu+/rV7V8qb297pM9hAk8FyDf83Nhp1nl1BwYoRhQzQkSTtrdEMB7QrBAUPu6sb2UK43 //+x+YbssYHN8KgZiSXDk8jLVhGTkUFWI+JtRiXOCzd7A9KB/R3Y5wT5YZFRNWA9f9/Q d7fgkxFCzq/nXDpZpKsR5pbagPrYbx5zTkzfirN/+Gb5yFbf1vI1NMiM/+QVZPIOy/7K pF3w== X-Gm-Message-State: AOAM531lUF5/B5V91m7+2iKsCBCqf2d0MLrC8wifYXwRaxSHdCBxUxlH Y2/ph5i16Nm2fOIlHFcVo38wKyago7XTqw== X-Google-Smtp-Source: ABdhPJzLqMsnLMPvGdhxOIAZknG2A6+FjpI61RRz3z7P/lXPniJ2K1srqD2T7QxPmAbMBUmRRuhI/A== X-Received: by 2002:a67:d216:: with SMTP id y22mr80660861vsi.6.1637245246039; Thu, 18 Nov 2021 06:20:46 -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 11:20:23 -0300 Message-Id: <20211118142024.275704-7-danielhb413@gmail.com> In-Reply-To: <20211118142024.275704-1-danielhb413@gmail.com> References: <20211118142024.275704-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.84 on 10.11.54.1 X-loop: libvir-list@redhat.com Cc: danielhb413@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.11 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: 1637245265365100002 Content-Type: text/plain; charset="utf-8" The 'xmlopt' parameter can be auto-unref by using g_autoptr(). Signed-off-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- 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