From nobody Sun Feb 8 18:24:29 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=1635159546; cv=none; d=zohomail.com; s=zohoarc; b=HJyjFLIiKR7PcxuWaSTEcYsSjUfc6ARHSB9HNGP+0M9DZqz7K3F34yLV/6OcSyZvHJsKgyJ/JHnd9q4dWiDB3xVKc/I7GW9gqqr1BtK1wiSX1pTqA8NVOg+WItDmIKyLqkG4m3Z25WK6L66Q+/j7kAOLxf90uScrOUZ8z0Syzpo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635159546; 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=zU8SCxpwOIh9DyPG+cYSSY/3EN7KRdjUtwFn12e+PU8=; b=EEJtI7t/vWFQmjR+WmOLqGCY57jIcQrJz4RbwuaymgdOc+LV4tNCpLh327cXjLtAnhFT78MOLnlDIULGwbcTRAQIRQrC82KNBSKOYezyV/e/K/bA7gDhLahcPG3NgpmHZVZ4Itol3PkJ/o1ca6qZivN/QRA7YFrZkX5f4JqlXto= 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 1635159546962641.899378192347; Mon, 25 Oct 2021 03:59:06 -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-277-5eb0dL2jNZukn6E_croTZw-1; Mon, 25 Oct 2021 06:58:14 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2BD7680A5C5; Mon, 25 Oct 2021 10:58:09 +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 0EC011054FFF; Mon, 25 Oct 2021 10:58: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 C89684EA31; Mon, 25 Oct 2021 10:58:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19PAvu5B016897 for ; Mon, 25 Oct 2021 06:57:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 165CC17CE1; Mon, 25 Oct 2021 10:57:56 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9176D5DAA5 for ; Mon, 25 Oct 2021 10:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635159546; 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=zU8SCxpwOIh9DyPG+cYSSY/3EN7KRdjUtwFn12e+PU8=; b=IpHd2VN8uJ1dXgZR56b4TpO0Ac3NzJ5tzVNdJxgXfZLaOUAbemRXk0+cOyoWrXLUJkwhbT 6mYM9vl1KAARD6pjCmzCgVmmoq0tP69darjn1x+L7Wf3Fk/hugqWbO4J3d4/pBlkA+uBBA IQajjVdL1ti8Haa3M163jjH0btqUPh0= X-MC-Unique: 5eb0dL2jNZukn6E_croTZw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 09/13] qemuMonitorJSONExtractPRManagerInfo: Declare @entry inside the loop Date: Mon, 25 Oct 2021 12:57:33 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.84 on 10.5.11.22 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: 1635159548190100005 Content-Type: text/plain; charset="utf-8" The reason why @entry variable in qemuMonitorJSONExtractPRManagerInfo() was declared at the top most level was that the variable is used under the cleanup label. However, if declared using g_autofree then the variable can be declared inside the loop it is used in. Signed-off-by: Michal Privoznik --- src/qemu/qemu_monitor_json.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index f59688dfd5..f7bc680035 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8622,7 +8622,6 @@ static int qemuMonitorJSONExtractPRManagerInfo(virJSONValue *reply, GHashTable *info) { - qemuMonitorPRManagerInfo *entry =3D NULL; virJSONValue *data; int ret =3D -1; size_t i; @@ -8630,6 +8629,7 @@ qemuMonitorJSONExtractPRManagerInfo(virJSONValue *rep= ly, data =3D virJSONValueObjectGetArray(reply, "return"); =20 for (i =3D 0; i < virJSONValueArraySize(data); i++) { + g_autofree qemuMonitorPRManagerInfo *entry =3D NULL; virJSONValue *prManager =3D virJSONValueArrayGet(data, i); const char *alias; =20 @@ -8652,7 +8652,6 @@ qemuMonitorJSONExtractPRManagerInfo(virJSONValue *rep= ly, =20 ret =3D 0; cleanup: - VIR_FREE(entry); return ret; =20 malformed: --=20 2.32.0