From nobody Sat Feb 7 05:57:18 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=1632344186; cv=none; d=zohomail.com; s=zohoarc; b=FdwbLPaRyngxqJtRS3VQjkw+65KGWXDgRCL2n+omsdMTjpuVindp9yafsSLBbIwxjNt+Dr2Fr1B1PS0jRnDMeqJ8pYWubHHAsci/AiDn+9DQ/u2idMC6G2lyaYn1G9M9f3NI6vbsSKockQxii9FqSGSMtkI0DSUjkqSUcuI8z0M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632344186; 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=3fcSsszxaQYMwtfFo/CanIDvL4qQPH5i0FzqenXmpnk=; b=XdRao3lCT3JuA5WCEgKhWFtR1+GJroVsJWK2NIS4sUywym49VuFsfmCoG9BYinVUTtCpaeulO2XIcDwCtp6gK6ouwt+dmHusFaewW/kQ9X8KFk2QgZPLk/W4RkBHrskcOLK+tmvBm2m9MKUACCqHQEmYsC6y7aWZ8vmAMgI+vwg= 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 1632344186594795.8027279309862; Wed, 22 Sep 2021 13:56:26 -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-148-YHjPBGpGPiua2brTNU5FXA-1; Wed, 22 Sep 2021 16:56:22 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA549100F94E; Wed, 22 Sep 2021 20:56:16 +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 8424919733; Wed, 22 Sep 2021 20:56:16 +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 4D98418199EE; Wed, 22 Sep 2021 20:56:16 +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 18MKtvRP007531 for ; Wed, 22 Sep 2021 16:55:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 79A921972D; Wed, 22 Sep 2021 20:55:57 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id D059219724; Wed, 22 Sep 2021 20:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632344185; 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=3fcSsszxaQYMwtfFo/CanIDvL4qQPH5i0FzqenXmpnk=; b=TaeDku8uvY4BHndN8zonrfyDa0vAUnVWepmnPW2zJ3M1UiSRbhtL6GMLPmWcYMJ/5ZqoBi kHi8w8Lb2BXLhdcmNLjKOhrNQNzaVK92spPLEg0GMLiDCn8RkMDATjlrD2vzjnsDB4hoF0 Ljn5EEk+vckDPNrdGze1aZUlCaDYyKs= X-MC-Unique: YHjPBGpGPiua2brTNU5FXA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/9] ch: use g_auto in virCHMonitorBuildMemoryJson Date: Wed, 22 Sep 2021 22:55:29 +0200 Message-Id: <55abdc21b67f048b03c6ad595d5517c524d83cb7.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.84 on 10.5.11.23 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: 1632344186996100001 Signed-off-by: J=C3=A1n Tomko --- src/ch/ch_monitor.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index d241d30b10..9c562fdd0f 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -149,22 +149,18 @@ virCHMonitorBuildKernelRelatedJson(virJSONValue *cont= ent, virDomainDef *vmdef) static int virCHMonitorBuildMemoryJson(virJSONValue *content, virDomainDef *vmdef) { - virJSONValue *memory; + g_autoptr(virJSONValue) memory =3D NULL; unsigned long long total_memory =3D virDomainDefGetMemoryInitial(vmdef= ) * 1024; =20 if (total_memory !=3D 0) { memory =3D virJSONValueNewObject(); if (virJSONValueObjectAppendNumberUlong(memory, "size", total_memo= ry) < 0) - goto cleanup; + return -1; if (virJSONValueObjectAppend(content, "memory", &memory) < 0) - goto cleanup; + return -1; } =20 return 0; - - cleanup: - virJSONValueFree(memory); - return -1; } =20 static int --=20 2.31.1