From nobody Sat Feb 7 05:57:15 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=1632344170; cv=none; d=zohomail.com; s=zohoarc; b=KVIrCyOOUyKfJqwcROGSXUjg9mcYCWN0UfXQkCGqeDiswJN/AYNOCzZagt8rwl5FujFy7iocf9wORh7BZmlngV/1jxuq5DnYIOTX88sRXJThnq+duKtexdQMdZK8crxTSmm5OEv0YzcJ+IFI2QIuX+4y5ylTL/1w2vGCQOA4x2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632344170; 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=Dj4pLP07MupC4D/Yt1sq3Pu5PEueiRhRmIkH0YJ8Ssk=; b=RJvig63IhM9QjgaCAVaorMPMpUzQ34nP885XsA9xVwYSC/i0UKu1ZZiPyxXRxEm/JV/Lcyx8DOTRPeCRRNkrJBJXg5ImrODe/1ieELOWVomcpmOGeVTVJ/zVasMOg2TsCkpk4J2UQqy+vMi6HMGu1hygJwh1vE0nxgZhAfuz6R4= 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 1632344170755281.97116846264555; Wed, 22 Sep 2021 13:56:10 -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-461-OrV7Jxu-P8WHwLDC7hUsYQ-1; Wed, 22 Sep 2021 16:56:07 -0400 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 5EEB18145EF; Wed, 22 Sep 2021 20:56:01 +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 B85F96060F; Wed, 22 Sep 2021 20:56:00 +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 DDCFA4E9F4; Wed, 22 Sep 2021 20:55:59 +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 18MKtwYj007540 for ; Wed, 22 Sep 2021 16:55:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6FBFB1972D; Wed, 22 Sep 2021 20:55:58 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id C711119724; Wed, 22 Sep 2021 20:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632344169; 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=Dj4pLP07MupC4D/Yt1sq3Pu5PEueiRhRmIkH0YJ8Ssk=; b=GtK0V/etKrBjobhcbELPyp+uOuNf+/WMpZnNteC85oLxdeznM/FkKq4MfYfVGuSGCY249m 9EVBr+sSuuqhIwklS+AbVhmRU74aNPthcz9NSOtQWw72TiOjHqPWmOAejR0BKemAI+3VaK k+/Kg5+uKe8Wd9xi0YhD8PUBcbtLZ1k= X-MC-Unique: OrV7Jxu-P8WHwLDC7hUsYQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/9] ch: use g_auto in virCHMonitorBuildDiskJson Date: Wed, 22 Sep 2021 22:55:30 +0200 Message-Id: <0f430927078507fa152a999a4640d7a23f561581.1632344053.git.jtomko@redhat.com> 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.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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1632344172042100001 Signed-off-by: J=C3=A1n Tomko --- src/ch/ch_monitor.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 9c562fdd0f..174ea47c51 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -166,31 +166,31 @@ virCHMonitorBuildMemoryJson(virJSONValue *content, vi= rDomainDef *vmdef) static int virCHMonitorBuildDiskJson(virJSONValue *disks, virDomainDiskDef *diskdef) { - virJSONValue *disk =3D virJSONValueNewObject(); + g_autoptr(virJSONValue) disk =3D virJSONValueNewObject(); =20 if (!diskdef->src) - goto cleanup; + return -1; =20 switch (diskdef->src->type) { case VIR_STORAGE_TYPE_FILE: if (!diskdef->src->path) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Missing disk file path in domain")); - goto cleanup; + return -1; } if (diskdef->bus !=3D VIR_DOMAIN_DISK_BUS_VIRTIO) { virReportError(VIR_ERR_INVALID_ARG, _("Only virtio bus types are supported for '%s'= "), diskdef->src->path); - goto cleanup; + return -1; } if (virJSONValueObjectAppendString(disk, "path", diskdef->src->pat= h) < 0) - goto cleanup; + return -1; if (diskdef->src->readonly) { if (virJSONValueObjectAppendBoolean(disk, "readonly", true) < = 0) - goto cleanup; + return -1; } if (virJSONValueArrayAppend(disks, &disk) < 0) - goto cleanup; + return -1; =20 break; case VIR_STORAGE_TYPE_NONE: @@ -202,14 +202,10 @@ virCHMonitorBuildDiskJson(virJSONValue *disks, virDom= ainDiskDef *diskdef) case VIR_STORAGE_TYPE_VHOST_USER: default: virReportEnumRangeError(virStorageType, diskdef->src->type); - goto cleanup; + return -1; } =20 return 0; - - cleanup: - virJSONValueFree(disk); - return -1; } =20 static int --=20 2.31.1