From nobody Sun Feb 8 17:22:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1639052388; cv=none; d=zohomail.com; s=zohoarc; b=V6kjPLpnzyulTddO19/T9t/zcFsnkgIUk5B2sJL6SBPAtMbsjEHN84MkW1mgAGF3zr8hEAVI7VpAL0ccSJg34obZcFZ+rc4tUA+ZVffrhPmRYcoGgWoJBdwHKhkPKB5PdMQZVF2jcNXZAfXo+o6qIxMiUI/kJm8j5NezIIz2l8A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639052388; 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=gmeHj6RSrB85C5XUiJYnjSXLyjiBChCpOz0y9xtil9I=; b=h0SjjPH+Q338OShEjE0QvkBXvXnInPNzVRfiLz7fWXxzBnU9CczbtpaqIkx1GgqOC4Ny3sek3LAC30RTh6SI/LFt095+Pxt6EOmARoskbvjrSxJR7oiIJdb9Zwhv1HafYWltzEeKeDfPRlRHJh4b8eJOoBvOZP1beGYKhRFWtws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 163905238865383.23256816409003; Thu, 9 Dec 2021 04:19:48 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-103-Cya-bQUzNMaKnsJtzdyqng-1; Thu, 09 Dec 2021 07:19:46 -0500 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 373C510151E1; Thu, 9 Dec 2021 12:19:40 +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 1D7C545D72; Thu, 9 Dec 2021 12:19:40 +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 E0CBD180B654; Thu, 9 Dec 2021 12:19:39 +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 1B9CJcGi013942 for ; Thu, 9 Dec 2021 07:19:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2621617DBA; Thu, 9 Dec 2021 12:19:38 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 86E0B5E24E for ; Thu, 9 Dec 2021 12:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639052387; 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=gmeHj6RSrB85C5XUiJYnjSXLyjiBChCpOz0y9xtil9I=; b=b+HNm7RzDrUsalV0T8ugTGM3bzjc2BX7wlra60G3XPG0PXK9KOlIjHZsjMH2wqEk6D1whH 1YuDDUMd2lH1hBZNLg/gtjtxJZxaLHvXwmlm86dpW7/hgTSLOKFy6S5b4A3Du6xq3QWuLj lcNhWUKULktWbDbVihdp4mAkfiq1/z8= X-MC-Unique: Cya-bQUzNMaKnsJtzdyqng-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/36] virDomainDriverGetIOThreadsConfig: Automatically free virBitmap Date: Thu, 9 Dec 2021 13:18:10 +0100 Message-Id: <44c5a841bb7aeb9e3b9abcdfd15bf90aded41638.1639052248.git.pkrempa@redhat.com> 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.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: 1639052390576100001 Content-Type: text/plain; charset="utf-8" Use g_autoptr for the temp bitmap. To achieve this the variable must be moved down to the appropriate scope. Signed-off-by: Peter Krempa --- src/hypervisor/domain_driver.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c index 31737b0f4a..2083f06287 100644 --- a/src/hypervisor/domain_driver.c +++ b/src/hypervisor/domain_driver.c @@ -592,8 +592,6 @@ virDomainDriverGetIOThreadsConfig(virDomainDef *targetD= ef, unsigned int bitmap_size) { virDomainIOThreadInfoPtr *info_ret =3D NULL; - virBitmap *bitmap =3D NULL; - virBitmap *cpumask =3D NULL; size_t i; int ret =3D -1; @@ -603,6 +601,8 @@ virDomainDriverGetIOThreadsConfig(virDomainDef *targetD= ef, info_ret =3D g_new0(virDomainIOThreadInfoPtr, targetDef->niothreadids); for (i =3D 0; i < targetDef->niothreadids; i++) { + g_autoptr(virBitmap) bitmap =3D NULL; + virBitmap *cpumask =3D NULL; info_ret[i] =3D g_new0(virDomainIOThreadInfo, 1); /* IOThread ID's are taken from the iothreadids list */ @@ -627,8 +627,6 @@ virDomainDriverGetIOThreadsConfig(virDomainDef *targetD= ef, if (virBitmapToData(cpumask, &info_ret[i]->cpumap, &info_ret[i]->cpumaplen) < 0) goto cleanup; - virBitmapFree(bitmap); - bitmap =3D NULL; } *info =3D g_steal_pointer(&info_ret); @@ -640,7 +638,6 @@ virDomainDriverGetIOThreadsConfig(virDomainDef *targetD= ef, virDomainIOThreadInfoFree(info_ret[i]); VIR_FREE(info_ret); } - virBitmapFree(bitmap); return ret; } --=20 2.31.1