From nobody Sat Feb 7 05:57:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1632344192; cv=none; d=zohomail.com; s=zohoarc; b=SXWPrQaGmKfloI/9RDkOrN4kXiyTMQxWFjCQQnP/6mzUf4UanCMzjnEME/UVZ5U20Qa5poxwt36JQP+4JqJVxfKEwbvpxL4S3iUkdWenAXKZtwSyvcdTYCWLSeE3Pr77BwKNAj2YsxOBY5q4IfZ2OORXVw53ubPnHg5tV74ASTc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632344192; h=Content-Type:Content-Transfer-Encoding:Cc: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=I0D1HD82qAHj9HHQvnWeB1/Kxhh+w0WiiN9IwZxzxgQ=; b=i7YleyQLKZq2Yw09Oe+zq7q0ImzMx4MW6HkwDZ9TJGvSITyVFX2CwGPekZxHofjzp7Uff3W935bH7F0fa2fWwzmONvmE2EoF8AN1UtzVJ1FpAblw2H4BvEEtJsH6/8y9NSY0yY3PbELob2BVWcxYb0GpADlrjMBTuv/Yep6ZEyQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1632344192630243.42923324581773; Wed, 22 Sep 2021 13:56:32 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-447-Fe3dFVA5OS-wgQcKDSl4Cw-1; Wed, 22 Sep 2021 16:56:29 -0400 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 670068145E5; Wed, 22 Sep 2021 20:56:24 +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 4B221970E8; Wed, 22 Sep 2021 20:56:24 +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 1B503181A1D1; Wed, 22 Sep 2021 20:56:24 +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 18MKuM0o007688 for ; Wed, 22 Sep 2021 16:56:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 26B161973B; Wed, 22 Sep 2021 20:56:22 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7CD1C19733; Wed, 22 Sep 2021 20:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632344191; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=I0D1HD82qAHj9HHQvnWeB1/Kxhh+w0WiiN9IwZxzxgQ=; b=N9jClkchu4pkw/sQQ5MS/NGc6ZpHVe8UYej+lmef3PkwKAF7PpJQVrwhaRL4Fytprj9rJF fp7dz3OVWiG/DmujiTHy05Cv3RUCUUFlvkR8rZbtgJjrrP9g/WiTQa3NaQ7kFxbW+e45Z2 /kIclEe8ZKyyZNjZ7tJ91TyGkt5kURM= X-MC-Unique: Fe3dFVA5OS-wgQcKDSl4Cw-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 9/9] ch: use g_auto in virCHMonitorNew Date: Wed, 22 Sep 2021 22:55:35 +0200 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 Cc: william.douglas@intel.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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1632344193516100001 Signed-off-by: J=C3=A1n Tomko --- src/ch/ch_monitor.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 3504c21f9d..804704e66d 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -445,9 +445,8 @@ chMonitorCreateSocket(const char *socket_path) virCHMonitor * virCHMonitorNew(virDomainObj *vm, const char *socketdir) { - virCHMonitor *ret =3D NULL; virCHMonitor *mon =3D NULL; - virCommand *cmd =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; int socket_fd =3D 0; =20 if (virCHMonitorInitialize() < 0) @@ -468,7 +467,7 @@ virCHMonitorNew(virDomainObj *vm, const char *socketdir) virReportSystemError(errno, _("Cannot create socket directory '%s'"), socketdir); - goto cleanup; + return NULL; } =20 cmd =3D virCommandNew(vm->def->emulator); @@ -478,7 +477,7 @@ virCHMonitorNew(virDomainObj *vm, const char *socketdir) virReportSystemError(errno, _("Cannot create socket '%s'"), mon->socketpath); - goto cleanup; + return NULL; } =20 virCommandAddArg(cmd, "--api-socket"); @@ -487,7 +486,7 @@ virCHMonitorNew(virDomainObj *vm, const char *socketdir) =20 /* launch Cloud-Hypervisor socket */ if (virCommandRunAsync(cmd, &mon->pid) < 0) - goto cleanup; + return NULL; =20 /* get a curl handle */ mon->handle =3D curl_easy_init(); @@ -496,11 +495,7 @@ virCHMonitorNew(virDomainObj *vm, const char *socketdi= r) virObjectRef(mon); mon->vm =3D virObjectRef(vm); =20 - ret =3D mon; - - cleanup: - virCommandFree(cmd); - return ret; + return mon; } =20 static void virCHMonitorDispose(void *opaque) --=20 2.31.1