From nobody Sat Feb 7 05:57:19 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=1632344193; cv=none; d=zohomail.com; s=zohoarc; b=PAXNPDtjyOhV0pf/unfQVsFVZwbneYDCEG49iHEOOMZ8NH/g2RG0uEknTlFEnCykbDLH8/1+duKoLhPOPZ/kYMUl8PflVcUZKB9JRuoMcO7Gs3B4W72O7tx/VTVMbaaYkY5UKOZeZHd5YYInNGzesnnFqQWT4Q3t6Q9ACYVio1s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632344193; 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=TlYH3LNGgZ3OGLtQcAfQtH+r+7nG3vDKQdLw7QbXhR8=; b=Yj1/J9tCPrq93osOM9jmh2mIODPWeYKginhzN4zs8Iq5PXyIsFcgf2Ymvsc2B6p0uOahzyiilc3V/HJPNgPu9cdQN6awFglV+JWR6sKn9fcQLC0wEW79boCP+QW70mb4K/+7WjG3u/WNT8mtxelinlwetuPX79GnreQ/7GilUHI= 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 1632344193097974.5311041201816; Wed, 22 Sep 2021 13:56:33 -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-207-rYQ8EOtUPQ-ggAnF99JHgA-1; Wed, 22 Sep 2021 16:56:28 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2710E1006AA6; Wed, 22 Sep 2021 20:56:23 +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 08E8F6B909; Wed, 22 Sep 2021 20:56:23 +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 C9C234EA3D; Wed, 22 Sep 2021 20:56:22 +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 18MKuL8d007680 for ; Wed, 22 Sep 2021 16:56:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2FB0E1973B; Wed, 22 Sep 2021 20:56:21 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8636219733; Wed, 22 Sep 2021 20:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632344192; 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=TlYH3LNGgZ3OGLtQcAfQtH+r+7nG3vDKQdLw7QbXhR8=; b=XTEq43vW1sedMx+CaA2Se4XPfUiiVYIHdQ9y38QtzGpdKJYqFOEMySmIHUIYjF1DUW1cnn q7V0IiY3eoeX3UnNdMMeCdE0puINMA2Z5StVSlSNhBC3u/KaT0/u7Ef+/0M4ApqN6RQrMR kcxnkVG3K4Q/B3sKsOThEJsw1ZHL4T0= X-MC-Unique: rYQ8EOtUPQ-ggAnF99JHgA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 8/9] ch: use g_auto in virCHMonitorBuildVMJson Date: Wed, 22 Sep 2021 22:55:34 +0200 Message-Id: <25bfb7772f0dc6485175e1172de7fce00ee7a1ac.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.15 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: 1632344193585100002 Signed-off-by: J=C3=A1n Tomko --- src/ch/ch_monitor.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index aa27eea304..3504c21f9d 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -354,41 +354,36 @@ virCHMonitorBuildNetsJson(virJSONValue *content, virD= omainDef *vmdef) static int virCHMonitorBuildVMJson(virDomainDef *vmdef, char **jsonstr) { - virJSONValue *content =3D virJSONValueNewObject(); - int ret =3D -1; + g_autoptr(virJSONValue) content =3D virJSONValueNewObject(); =20 if (vmdef =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("VM is not defined")); - goto cleanup; + return -1; } =20 if (virCHMonitorBuildPTYJson(content, vmdef) < 0) - goto cleanup; + return -1; =20 if (virCHMonitorBuildCPUJson(content, vmdef) < 0) - goto cleanup; + return -1; =20 if (virCHMonitorBuildMemoryJson(content, vmdef) < 0) - goto cleanup; + return -1; =20 if (virCHMonitorBuildKernelRelatedJson(content, vmdef) < 0) - goto cleanup; + return -1; =20 if (virCHMonitorBuildDisksJson(content, vmdef) < 0) - goto cleanup; + return -1; =20 if (virCHMonitorBuildNetsJson(content, vmdef) < 0) - goto cleanup; + return -1; =20 if (!(*jsonstr =3D virJSONValueToString(content, false))) - goto cleanup; + return -1; =20 - ret =3D 0; - - cleanup: - virJSONValueFree(content); - return ret; + return 0; } =20 static int --=20 2.31.1