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=1632344163; cv=none; d=zohomail.com; s=zohoarc; b=JwCPtvbEmS5HPFjA4NwilspPBAYiMs1z/ruByU/SguC/ZJgAhBZqMg1I6zOpExKwASmudARgS0GMcK475iq9zKEajpeMxrmTUTGqrk8J35oDG5AvtL/Hh92XoKDjsvZi4MMd4+dDNbeQAqPZSylC7aV0VFdkQfYwJxyR4zuj+UY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632344163; 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=6rEvfECoslECDfRqT+0MFP43sfWpBOmwUg6Y17N3Z1g=; b=LEssUhosbGHG9DleHMQdcfCLQcrwSjRrOZ2dVGPGi9n09d0vkf6raj5PbtqSPL65A+9PvG5yw1MHP08XK9xw8uzbEp2ouNWRKVCpS2cR8QhtzgAeMJWNenLHkHmlHdZyShl091MrrVB+C3tsi052c0H839WH3L3smAa++r/VOxo= 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 1632344163440748.6570761148051; Wed, 22 Sep 2021 13:56:03 -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-495-Xh4oGYKeNceml2QZ9Y1GLg-1; Wed, 22 Sep 2021 16:56:00 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9B5218145E7; Wed, 22 Sep 2021 20:55:55 +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 DE0EF5D9DC; Wed, 22 Sep 2021 20:55:53 +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 1A5401800FE4; Wed, 22 Sep 2021 20:55:50 +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 18MKtmYI007502 for ; Wed, 22 Sep 2021 16:55:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id CB6181972D; Wed, 22 Sep 2021 20:55:48 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2518419724; Wed, 22 Sep 2021 20:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632344162; 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=6rEvfECoslECDfRqT+0MFP43sfWpBOmwUg6Y17N3Z1g=; b=FnWjbe6kCNEUbrjPtXmb5zF3x9+n5JgsdGzSrkQYzpTyEPEUTUynqOKm67jeJnsGOSUMdv dc29nCtMYCjiAM4kdLu2MCpb6rEqqidQGYtE1nMae2Vrt+4MkB03fmVYHbOXLFgDz0BEwq suoxeGwY6mCwWI/bAAs6esfyAQL6oqA= X-MC-Unique: Xh4oGYKeNceml2QZ9Y1GLg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/9] ch: use g_auto in virCHMonitorBuildCPUJson Date: Wed, 22 Sep 2021 22:55:27 +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.14 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: 1632344165590100001 Signed-off-by: J=C3=A1n Tomko --- src/ch/ch_monitor.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index d277466262..876a553f74 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -58,7 +58,7 @@ int virCHMonitorPutNoContent(virCHMonitor *mon, const cha= r *endpoint); static int virCHMonitorBuildCPUJson(virJSONValue *content, virDomainDef *vmdef) { - virJSONValue *cpus; + g_autoptr(virJSONValue) cpus =3D NULL; unsigned int maxvcpus =3D 0; unsigned int nvcpus =3D 0; virDomainVcpuDef *vcpu; @@ -75,18 +75,14 @@ virCHMonitorBuildCPUJson(virJSONValue *content, virDoma= inDef *vmdef) if (maxvcpus !=3D 0 || nvcpus !=3D 0) { cpus =3D virJSONValueNewObject(); if (virJSONValueObjectAppendNumberInt(cpus, "boot_vcpus", nvcpus) = < 0) - goto cleanup; + return -1; if (virJSONValueObjectAppendNumberInt(cpus, "max_vcpus", vmdef->ma= xvcpus) < 0) - goto cleanup; + return -1; if (virJSONValueObjectAppend(content, "cpus", &cpus) < 0) - goto cleanup; + return -1; } =20 return 0; - - cleanup: - virJSONValueFree(cpus); - return -1; } =20 static int --=20 2.31.1