From nobody Fri Dec 19 08:07:53 2025 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=1634654666; cv=none; d=zohomail.com; s=zohoarc; b=PU1ITXGmVnuX4T+FYg9uI5DTwC90CCthSWzswtLbBQ8aOkbfb1/BdmyhFNC8iexB6MB1vjVohh37V63jHlRTlUs4JV2D8fK1t04CCE0AdDvg/R9L6D5VWzI7KpBwR7xqQyHj8RkpsGb1aasYhcRPgv8jcKafKylrh5bb6MH4Mm0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634654666; h=Content-Type:Content-Transfer-Encoding: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=+VCWmB4N8ccQOqN/Z563hMHmp0TsiN5wAXhF7TJPHpA=; b=bg0d7BxYXZxzb7PENfdN3Pm+ZvoCwadKQpkaDwNnUDFLyzST4/IZgDDKzceYrY+wmUfzgNz6J+aEECrdsnoWFHHqfN7AL4VwG7I2nwDFoiTgGitjiPdmBWD2U+bZm8PDiY+6gI+yB86nGpEYtpbf/swOyjh+979jx6a1u/6PxE8= 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 16346546664329.975604971387497; Tue, 19 Oct 2021 07:44: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-518-HF2UD7Z6PCWvWiIWLnl7bw-1; Tue, 19 Oct 2021 10:44:21 -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 80C7B1808321; Tue, 19 Oct 2021 14:44: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 62C5E18A8F; Tue, 19 Oct 2021 14:44: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 2DBD01832DD8; Tue, 19 Oct 2021 14:44: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 19JEhLws031705 for ; Tue, 19 Oct 2021 10:43:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 520D819D9F; Tue, 19 Oct 2021 14:43:21 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5D0019C79 for ; Tue, 19 Oct 2021 14:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634654665; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=+VCWmB4N8ccQOqN/Z563hMHmp0TsiN5wAXhF7TJPHpA=; b=X3M2rbXmOVHe/OMsUFuLiL97kRf+/+OcK4xoOti/GdyHqNZ0gjT6Ad45nT0DxF2o8x8bzi IsfxiJ5ZmS+BgcDQb1XtRWYifpELvX4L6FmjfQS3D7AMB8dnN3hDJPVq+SigPKJNySvSj1 CRbim1HrOG2moA+NikXPcxNYoE2ushk= X-MC-Unique: HF2UD7Z6PCWvWiIWLnl7bw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/8] qemuMonitorJSONBlockStatsUpdateCapacityOne: Refactor cleanup Date: Tue, 19 Oct 2021 16:43:11 +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 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1634654667245100001 Content-Type: text/plain; charset="utf-8" Use automatic memory clearing for the temporary variable and remove the cleanup section. Signed-off-by: Peter Krempa --- src/qemu/qemu_monitor_json.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index af6e918e06..e4f4dba79a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2631,13 +2631,12 @@ qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONV= alue *image, GHashTable *stats, bool backingChain) { - int ret =3D -1; - char *entry_name =3D qemuDomainStorageAlias(dev_name, depth); + g_autofree char *entry_name =3D qemuDomainStorageAlias(dev_name, depth= ); virJSONValue *backing; if (qemuMonitorJSONBlockStatsUpdateCapacityData(image, entry_name, stats, NULL) < 0) - goto cleanup; + return -1; if (backingChain && (backing =3D virJSONValueObjectGetObject(image, "backing-image")) = && @@ -2646,12 +2645,9 @@ qemuMonitorJSONBlockStatsUpdateCapacityOne(virJSONVa= lue *image, depth + 1, stats, true) < 0) - goto cleanup; + return -1; - ret =3D 0; - cleanup: - VIR_FREE(entry_name); - return ret; + return 0; } --=20 2.31.1