From nobody Mon Feb 9 00:06:54 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=1644482021; cv=none; d=zohomail.com; s=zohoarc; b=bsmQ5K6UgpGdXOmj3oG7Tac83lN8FFNjFzfjcK8WCMzY6R+kSqVmASu1oooDQQyfn5FWsgQ4jV6Mg4+cc2XYWWT52iiTjrikY29ON1hFcnMQ2Qc9h1UkFkYM1u2f64EbYa1zaQzqqYmvo4uWY5ZSn9oYAD/2o8P1XjM/M0m6KMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644482021; 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=3pzlCHNwSKupWGmsujvz0qp9YKEJaaPcQymtaZHBfmE=; b=KFnUiF7jePLPaidQXD7lM1VwyT2MhAvdvCuy2B58GZ81IWW3womxdwD2D6Hr+nSUib7UC3067T1lpWbCqeGWCt+yP7Zx2erWxgcGj8xan9whuMc9sd6eJo7fBoxpIVr3Wer28Zz/iCzliYbhWG7SEPC0QqAK5iC1Ige+9OFIuk8= 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 1644482021938615.1852291579104; Thu, 10 Feb 2022 00:33:41 -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-232-T8fWW6QLPO-8zOYAhq8uuA-1; Thu, 10 Feb 2022 03:33:39 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91D0A83DD47; Thu, 10 Feb 2022 08:33:34 +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 4D7C57C1EE; Thu, 10 Feb 2022 08:33:34 +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 132914A7C9; Thu, 10 Feb 2022 08:33:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21A8XRbE003034 for ; Thu, 10 Feb 2022 03:33:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 572DB26DC6; Thu, 10 Feb 2022 08:33:27 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACE452657D for ; Thu, 10 Feb 2022 08:33:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644482020; 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=3pzlCHNwSKupWGmsujvz0qp9YKEJaaPcQymtaZHBfmE=; b=IqGzNm2/Pbf0C0Z4jMegFe6Q8Kie0Jc/d3Qs2F5/QxuZwtPblj7aUiAMwraBhin/OiOOYz 2495v8xj6P0X5g/6rnpdTIMmWPDn7RMarG3uiN3QNYLDUMh66OSFfc4I/qPuT2Hk0Ccp0/ kP4oduIncx35BcYbLN7EKJSxD6kRcnI= X-MC-Unique: T8fWW6QLPO-8zOYAhq8uuA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/2] qemuMonitorOpen: Refactor cleanup Date: Thu, 10 Feb 2022 09:33:10 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.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.13 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) X-ZM-MESSAGEID: 1644482023269100001 Content-Type: text/plain; charset="utf-8" Use VIR_AUTOCLOSE to avoid a 'cleanup' label. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 04b5cce6fb..95ed6199b1 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -725,7 +725,7 @@ qemuMonitorOpen(virDomainObj *vm, qemuMonitorCallbacks *cb, void *opaque) { - int fd =3D -1; + VIR_AUTOCLOSE fd =3D -1; qemuMonitor *ret =3D NULL; timeout +=3D QEMU_DEFAULT_MONITOR_WAIT; @@ -734,7 +734,7 @@ qemuMonitorOpen(virDomainObj *vm, virReportError(VIR_ERR_INTERNAL_ERROR, _("unable to handle monitor type: %s"), virDomainChrTypeToString(config->type)); - goto cleanup; + return NULL; } virObjectUnlock(vm); @@ -743,18 +743,16 @@ qemuMonitorOpen(virDomainObj *vm, virObjectLock(vm); if (fd < 0) - goto cleanup; + return NULL; if (!virDomainObjIsActive(vm)) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("domain is not running")); - goto cleanup; + return NULL; } ret =3D qemuMonitorOpenInternal(vm, fd, context, cb, opaque); - cleanup: - if (!ret) - VIR_FORCE_CLOSE(fd); + fd =3D -1; return ret; } --=20 2.34.1