From nobody Sat Feb 7 04:47:34 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 Reviewed-by: Laine Stump --- 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 From nobody Sat Feb 7 04:47:34 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=1632344181; cv=none; d=zohomail.com; s=zohoarc; b=mkrxThlEZK5dsc85bgay3bzZF8Ud/sTyyz3vXvw3nZjvIzcIepbEap6VAQq2C7j9RcKAyDQ0hSgdZAOuYdllsEv9S6VVLOIq5iS8KX9HcWnYDO+1YMQJfvzq7iSa4WhgvVwtEdtN8XF3/ssIcg7ygOSmzz0CDuAbM+cu5ADFawY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632344181; 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=sdc8fytER0hsHjNNAOxuYrybOWwOWGTyVJhqLZ7yvNg=; b=gJXau8UWrLzoncZ6T60tvEo9ZCRhbDUoUUBWO5/MnGT6r4jBFNiqvf6snHvxPuqZ3hIGtIvFBh6E1Q07LqbLrlhhrbO5rZ1CdAidoJm+uVsVkQ1FsLvSJ8nZaQWkD7y3y9oQTCqADrI3qXT7hl7+yXtcZfFIinbjwkEAe6rtvrs= 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 1632344181705271.1133284648006; Wed, 22 Sep 2021 13:56:21 -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-328-49qu966qPA6XCuugSpocdQ-1; Wed, 22 Sep 2021 16:56:18 -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 B0989100F943; Wed, 22 Sep 2021 20:56:13 +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 92B586B54E; Wed, 22 Sep 2021 20:56:13 +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 2FFCD1806D03; Wed, 22 Sep 2021 20:56:13 +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 18MKtnrO007512 for ; Wed, 22 Sep 2021 16:55:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id C331F1972D; Wed, 22 Sep 2021 20:55:49 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2549119724; Wed, 22 Sep 2021 20:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632344180; 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=sdc8fytER0hsHjNNAOxuYrybOWwOWGTyVJhqLZ7yvNg=; b=jKhyTkdqt2ap9fBfIBWddy88yLrpNasg8085OGOOwoewt7aSYHrkoMKs/tEswYbQBCXzAJ sJpaPOxl2x8iZB7W8/z+Ex3FitQnTxrw6rTEQqekfDdXNp7x7abiCBppwNbupZOEGuUjWj Putq+hs2ArjyYKTrGwoetwJ8PZrKCLw= X-MC-Unique: 49qu966qPA6XCuugSpocdQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/9] ch: use g_auto in virCHMonitorBuildKernelRelatedJson Date: Wed, 22 Sep 2021 22:55:28 +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.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: 1632344182591100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Laine Stump --- src/ch/ch_monitor.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 876a553f74..d241d30b10 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -112,45 +112,38 @@ virCHMonitorBuildPTYJson(virJSONValue *content, virDo= mainDef *vmdef) static int virCHMonitorBuildKernelRelatedJson(virJSONValue *content, virDomainDef *vm= def) { - virJSONValue *kernel =3D virJSONValueNewObject(); - virJSONValue *cmdline =3D virJSONValueNewObject(); - virJSONValue *initramfs =3D virJSONValueNewObject(); + g_autoptr(virJSONValue) kernel =3D virJSONValueNewObject(); + g_autoptr(virJSONValue) cmdline =3D virJSONValueNewObject(); + g_autoptr(virJSONValue) initramfs =3D virJSONValueNewObject(); =20 if (vmdef->os.kernel =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Kernel image path in this domain is not defined"= )); - goto cleanup; + return -1; } else { kernel =3D virJSONValueNewObject(); if (virJSONValueObjectAppendString(kernel, "path", vmdef->os.kerne= l) < 0) - goto cleanup; + return -1; if (virJSONValueObjectAppend(content, "kernel", &kernel) < 0) - goto cleanup; + return -1; } =20 if (vmdef->os.cmdline) { if (virJSONValueObjectAppendString(cmdline, "args", vmdef->os.cmdl= ine) < 0) - goto cleanup; + return -1; if (virJSONValueObjectAppend(content, "cmdline", &cmdline) < 0) - goto cleanup; + return -1; } =20 if (vmdef->os.initrd !=3D NULL) { initramfs =3D virJSONValueNewObject(); if (virJSONValueObjectAppendString(initramfs, "path", vmdef->os.in= itrd) < 0) - goto cleanup; + return -1; if (virJSONValueObjectAppend(content, "initramfs", &initramfs) < 0) - goto cleanup; + return -1; } =20 return 0; - - cleanup: - virJSONValueFree(kernel); - virJSONValueFree(cmdline); - virJSONValueFree(initramfs); - - return -1; } =20 static int --=20 2.31.1 From nobody Sat Feb 7 04:47:34 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 Reviewed-by: Laine Stump --- 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 From nobody Sat Feb 7 04:47:34 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 Reviewed-by: Laine Stump --- 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 From nobody Sat Feb 7 04:47:34 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=1632344232; cv=none; d=zohomail.com; s=zohoarc; b=jtesi9qt3o8xiZsrOV2zeSCWqMZxczCtdX+Q4qJv0tJHJgR6uUZZ4mRnjLqG9fCnle97KoG0iAHxLOrV7sxFCPHKB11B5q1GGHfxc+ak1MRAKmsuoRecoXFu0I3x+7Bq8vl2syZkTT9Z6CtqfQjw1xvVgS2UAHCgLj/TPLq8F9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632344232; 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=CP1daSIvvsYYLp1Y/ed0FqmZhGDweBwj7bZVDKVwY7M=; b=bvDzRsVgPcp4zsdge4DenGGQgdCIfnVm14MzLF3TVfY85j2bj4xMs5UnXHdB72x4iCzEFP6apUqd3ZrsXJMQL2a665/QLt0+8NkigZYfzU6MuFesDWC5DCmt8lw8UijmZmqk2dzSbMJC28I1HDNLImcxEP9XZVkJzLlmeDdeIj4= 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 1632344232640992.1470958950399; Wed, 22 Sep 2021 13:57:12 -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-600--U5ybilEMSCHyqTCSEtqUg-1; Wed, 22 Sep 2021 16:56:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9B578180830F; Wed, 22 Sep 2021 20:56:09 +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 7BB9660C9D; Wed, 22 Sep 2021 20:56:09 +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 23FCE1806D01; Wed, 22 Sep 2021 20:56:09 +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 18MKtxNc007547 for ; Wed, 22 Sep 2021 16:55:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 65BEC19733; Wed, 22 Sep 2021 20:55:59 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD42819724; Wed, 22 Sep 2021 20:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632344231; 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=CP1daSIvvsYYLp1Y/ed0FqmZhGDweBwj7bZVDKVwY7M=; b=HtS+yEl9edhdUv9nnx0oeM5NRepPEfrl9+igh3AxHK0K64H+GS+LH4KMKDkt1iLwXe8qXn 95KKflT44nNR1fymmMvIQX7RLBJViaxeGNB24iOs320nnWhRLFYePRedJioCQ1a37vBax5 LDUGOAsvYeVmpKwCEAnrsrUEiVtZt2E= X-MC-Unique: -U5ybilEMSCHyqTCSEtqUg-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 5/9] ch: use g_auto in virCHMonitorBuildDisksJson Date: Wed, 22 Sep 2021 22:55:31 +0200 Message-Id: <130f308b6dc9f8b092a1cec303a986453410c0c3.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.12 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: 1632344233031100003 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Laine Stump --- 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 174ea47c51..d268dc3c90 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -211,7 +211,7 @@ virCHMonitorBuildDiskJson(virJSONValue *disks, virDomai= nDiskDef *diskdef) static int virCHMonitorBuildDisksJson(virJSONValue *content, virDomainDef *vmdef) { - virJSONValue *disks; + g_autoptr(virJSONValue) disks =3D NULL; size_t i; =20 if (vmdef->ndisks > 0) { @@ -219,17 +219,13 @@ virCHMonitorBuildDisksJson(virJSONValue *content, vir= DomainDef *vmdef) =20 for (i =3D 0; i < vmdef->ndisks; i++) { if (virCHMonitorBuildDiskJson(disks, vmdef->disks[i]) < 0) - goto cleanup; + return -1; } if (virJSONValueObjectAppend(content, "disks", &disks) < 0) - goto cleanup; + return -1; } =20 return 0; - - cleanup: - virJSONValueFree(disks); - return -1; } =20 static int --=20 2.31.1 From nobody Sat Feb 7 04:47:34 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=1632344229; cv=none; d=zohomail.com; s=zohoarc; b=HWYopAP0YHImuF4cT9UQaczhUBjZs8GhxA8OHwtI0SnukY2hyWb2BGUQ9Q9wWg/68vjcoD+kZSEKxAcg5wPuSM3O3IUoaHXecsSXLUNvxrYKof8UOiLnQ7MVPTZvR/Qi4kX9vnVapA9ZgpsrQX6aAbc5Lj/4QMjSuxKCM9xUOQ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632344229; 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=WRvIOKlqmHZV64Whv13K6NoWp05LratIK+MxJxk8S3g=; b=Uihclbffl9w19w/h9bdBKBNw4DUnQ9c2jC69HaqJnmyxxLzBPzPEAeb/mZUlz1/RxF9O7NILIEpDXdurN8sLaMz8OhlbtS0kMc11zutaUFqbclyCpBXVJUK4XkFfEzkzJ2OSMF8gidcp41dUkvoV0caODBeciXB9/UPFyXOvVtE= 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 1632344229850284.7098659969703; Wed, 22 Sep 2021 13:57:09 -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-321-2ExIFIEXPMiZZNzxdVZOwQ-1; Wed, 22 Sep 2021 16:56:15 -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 15D291006AA6; Wed, 22 Sep 2021 20:56:10 +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 E20E619736; Wed, 22 Sep 2021 20:56:09 +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 AF4574EA3A; Wed, 22 Sep 2021 20:56:09 +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 18MKu2lQ007561 for ; Wed, 22 Sep 2021 16:56:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id B9DA219733; Wed, 22 Sep 2021 20:56:02 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CC5E1972D; Wed, 22 Sep 2021 20:55:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632344228; 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=WRvIOKlqmHZV64Whv13K6NoWp05LratIK+MxJxk8S3g=; b=Gye8KMAWrcTSPdGhgSLRXLQaX4gcgK+827f9/EwqHg48jM0jZMV1+YTsgRVuB08HywXHhR g3G+GVOlwYgEhIRB5FPiFApHwiggCZe0UdJpJQ0/AgFCO0MPng/d8BOZKU7Ckk/2yg3cV2 20zYwv+BBLvjme/wFFrTAYqMec69/7o= X-MC-Unique: 2ExIFIEXPMiZZNzxdVZOwQ-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 6/9] ch: use g_auto in virCHMonitorBuildNetJson Date: Wed, 22 Sep 2021 22:55:32 +0200 Message-Id: <2519ce06127d94e372ece602763378a89653cb72.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: 1632344230940100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Laine Stump --- src/ch/ch_monitor.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index d268dc3c90..21f8cb6782 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -233,7 +233,7 @@ virCHMonitorBuildNetJson(virJSONValue *nets, virDomainN= etDef *netdef) { virDomainNetType netType =3D virDomainNetGetActualType(netdef); char macaddr[VIR_MAC_STRING_BUFLEN]; - virJSONValue *net; + g_autoptr(virJSONValue) net =3D NULL; =20 // check net type at first net =3D virJSONValueNewObject(); @@ -246,20 +246,20 @@ virCHMonitorBuildNetJson(virJSONValue *nets, virDomai= nNetDef *netdef) virSocketAddr netmask; g_autofree char *netmaskStr =3D NULL; if (!(addr =3D virSocketAddrFormat(&ip->address))) - goto cleanup; + return -1; if (virJSONValueObjectAppendString(net, "ip", addr) < 0) - goto cleanup; + return -1; =20 if (virSocketAddrPrefixToNetmask(ip->prefix, &netmask, AF_INET= ) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to translate net prefix %d to net= mask"), ip->prefix); - goto cleanup; + return -1; } if (!(netmaskStr =3D virSocketAddrFormat(&netmask))) - goto cleanup; + return -1; if (virJSONValueObjectAppendString(net, "mask", netmaskStr) < = 0) - goto cleanup; + return -1; } else if (netdef->guestIP.nips > 1) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("ethernet type supports a single guest ip")); @@ -269,12 +269,12 @@ virCHMonitorBuildNetJson(virJSONValue *nets, virDomai= nNetDef *netdef) if ((virDomainChrType)netdef->data.vhostuser->type !=3D VIR_DOMAIN= _CHR_TYPE_UNIX) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("vhost_user type support UNIX socket in this = CH")); - goto cleanup; + return -1; } else { if (virJSONValueObjectAppendString(net, "vhost_socket", netdef= ->data.vhostuser->data.nix.path) < 0) - goto cleanup; + return -1; if (virJSONValueObjectAppendBoolean(net, "vhost_user", true) <= 0) - goto cleanup; + return -1; } break; case VIR_DOMAIN_NET_TYPE_BRIDGE: @@ -291,26 +291,26 @@ virCHMonitorBuildNetJson(virJSONValue *nets, virDomai= nNetDef *netdef) case VIR_DOMAIN_NET_TYPE_LAST: default: virReportEnumRangeError(virDomainNetType, netType); - goto cleanup; + return -1; } =20 if (netdef->ifname !=3D NULL) { if (virJSONValueObjectAppendString(net, "tap", netdef->ifname) < 0) - goto cleanup; + return -1; } if (virJSONValueObjectAppendString(net, "mac", virMacAddrFormat(&netde= f->mac, macaddr)) < 0) - goto cleanup; + return -1; =20 =20 if (netdef->virtio !=3D NULL) { if (netdef->virtio->iommu =3D=3D VIR_TRISTATE_SWITCH_ON) { if (virJSONValueObjectAppendBoolean(net, "iommu", true) < 0) - goto cleanup; + return -1; } } if (netdef->driver.virtio.queues) { if (virJSONValueObjectAppendNumberInt(net, "num_queues", netdef->d= river.virtio.queues) < 0) - goto cleanup; + return -1; } =20 if (netdef->driver.virtio.rx_queue_size || netdef->driver.virtio.tx_qu= eue_size) { @@ -319,20 +319,16 @@ virCHMonitorBuildNetJson(virJSONValue *nets, virDomai= nNetDef *netdef) _("virtio rx_queue_size option %d is not same with tx_queue= _size %d"), netdef->driver.virtio.rx_queue_size, netdef->driver.virtio.tx_queue_size); - goto cleanup; + return -1; } if (virJSONValueObjectAppendNumberInt(net, "queue_size", netdef->d= river.virtio.rx_queue_size) < 0) - goto cleanup; + return -1; } =20 if (virJSONValueArrayAppend(nets, &net) < 0) - goto cleanup; + return -1; =20 return 0; - - cleanup: - virJSONValueFree(net); - return -1; } =20 static int --=20 2.31.1 From nobody Sat Feb 7 04:47:34 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=1632344235; cv=none; d=zohomail.com; s=zohoarc; b=he5H5jjBSoBoOYhPecXl4drue9n4NrBKaiKW5sKuW8V5yZUK540kaHHH+SC9PUpc70M+Ndq2uFM2hV+z2cS3XZobk7TjFG9V+QXr7wuyyOs9KFoubUVRSIw7dbIHbdqEdbISB9DNbGM3AzCTRGF/4NlcHeDVIbcoFMC2CJkl1eM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632344235; 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=RHKk20W0vAgXgrWkG7OUOje3VfF0Qiw85HbZjGg47eE=; b=PnQcDbLcdkFF8BivnrqBzVt7zR6b+wGGPtqz5TvPnQvIKPWvMThnN+YZDxgP3LUm0Df0uttjiRkU1mFwxLbJ8Q93wXAZaN8Es8RJGo5IaSbEwtwNRy/gVAy3fdQMtqH1vRygTikQYg0C3LLrEt/mEXxcQPrbsex2vnAsSUaKaAk= 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 163234423548337.224419498020666; Wed, 22 Sep 2021 13:57:15 -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-71-yHZu0KBXNG-BzF9O5_e4OA-1; Wed, 22 Sep 2021 16:56:52 -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 C51DF1006AA7; Wed, 22 Sep 2021 20:56:19 +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 AAA96970F0; Wed, 22 Sep 2021 20:56:19 +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 765B34EA39; Wed, 22 Sep 2021 20:56:19 +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 18MKuIhb007636 for ; Wed, 22 Sep 2021 16:56:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4F0AF19733; Wed, 22 Sep 2021 20:56:18 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A66281973B; Wed, 22 Sep 2021 20:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632344234; 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=RHKk20W0vAgXgrWkG7OUOje3VfF0Qiw85HbZjGg47eE=; b=Z4Fw+zL57OGmtjYVu16liUyQ0aig19XiYMLmjeuj7OSj9O0JeCrE4kZEYc2cgqfCdbjALJ cQ3fPJD4moRgVmVBD20Q0ppUcwKQB2rW/b3EQ6UQFFuUrsTmDiHjTKV6ZOlvdtPutK24Dz sNkQU21AzaRMUusmjNUinYce8v1xm0M= X-MC-Unique: yHZu0KBXNG-BzF9O5_e4OA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 7/9] ch: use g_auto in virCHMonitorBuildNetsJson Date: Wed, 22 Sep 2021 22:55:33 +0200 Message-Id: <6d90a5d28474dd6d2ac8cd6e74b8171ae3ffd0b7.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.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: 1632344237302100001 Signed-off-by: J=C3=A1n Tomko Reviewed-by: Laine Stump --- 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 21f8cb6782..aa27eea304 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -334,7 +334,7 @@ virCHMonitorBuildNetJson(virJSONValue *nets, virDomainN= etDef *netdef) static int virCHMonitorBuildNetsJson(virJSONValue *content, virDomainDef *vmdef) { - virJSONValue *nets; + g_autoptr(virJSONValue) nets =3D NULL; size_t i; =20 if (vmdef->nnets > 0) { @@ -342,17 +342,13 @@ virCHMonitorBuildNetsJson(virJSONValue *content, virD= omainDef *vmdef) =20 for (i =3D 0; i < vmdef->nnets; i++) { if (virCHMonitorBuildNetJson(nets, vmdef->nets[i]) < 0) - goto cleanup; + return -1; } if (virJSONValueObjectAppend(content, "net", &nets) < 0) - goto cleanup; + return -1; } =20 return 0; - - cleanup: - virJSONValueFree(nets); - return -1; } =20 static int --=20 2.31.1 From nobody Sat Feb 7 04:47:34 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 Reviewed-by: Laine Stump --- 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 From nobody Sat Feb 7 04:47:34 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 Reviewed-by: Laine Stump --- 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