From nobody Sun Feb 8 05:23: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=1639052585; cv=none; d=zohomail.com; s=zohoarc; b=ReY2cMzLUb6dzicK+sMjScWTKHiCxhVzB3TpCDmkg4XoJTrIY7Q0mdyYIOW9MoC11xSyoK2VjlwB/s6Z2ZsYeNYD7Pno+SKsjrS0zrbqGxc2o/6LwMo56NMlyoxj41WDOQ9S0d9BE5qCzsMiMVvXQHluIDhFRBkyEIgcEEyaD9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639052585; 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=Grpp+CUDOLLg5DdOONHMkjZaHQp+mragLwfuMvIaEOE=; b=Zx30Z28K2qydwJUuikggC+gn6LKquezF1SNguOoBe1YovVMBOEGz0r+xVXzT7am3Hu9ffbvdpUJdFJ7ksH7M05FSj7kqqKTcGVNIhmBW/lwn7Ru8WvtBm8R/SDYRZla4E+KZvbZPO/4Lk4ItjA8tQJAY7GWBSGa0kQ82ArZoM14= 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 1639052585624736.1241649596802; Thu, 9 Dec 2021 04:23:05 -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-90-jQShryjaPUywptKudTjVVg-1; Thu, 09 Dec 2021 07:22:35 -0500 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 BC786802E6F; Thu, 9 Dec 2021 12:22:30 +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 6FFE75ED2D; Thu, 9 Dec 2021 12:22:30 +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 428FD4A700; Thu, 9 Dec 2021 12:22:30 +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 1B9CMR4O015682 for ; Thu, 9 Dec 2021 07:22:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9B57717CD9; Thu, 9 Dec 2021 12:22:27 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 072A05E26C for ; Thu, 9 Dec 2021 12:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639052584; 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=Grpp+CUDOLLg5DdOONHMkjZaHQp+mragLwfuMvIaEOE=; b=OKvLZYuUoepBMOrS9bZ12Gzq2OyFFEk192RnwWXMWswte6L3cfkb3QEgtQZVotMnBpqlaQ BnmkB33ocb5FL+AaVQmCtpOGShUSt4GBoAfc/9l3RNm8KF3Ja1+3vzZX6R5SMxWT3in1lI xk8pcfLQq7cTvHz+BoDk9W5yPAS/2Nc= X-MC-Unique: jQShryjaPUywptKudTjVVg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 28/36] test_driver: Use automatic memory freeing for temporary virBitmaps Date: Thu, 9 Dec 2021 13:18:33 +0100 Message-Id: <8c80d2bb30e08c3f4b04bf81bf0bcd0195bb5df2.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.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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1639052587606100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/test/test_driver.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 7ad6e15402..995e63b004 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2826,7 +2826,7 @@ testDomainPinEmulator(virDomainPtr dom, { virDomainObj *vm =3D NULL; virDomainDef *def =3D NULL; - virBitmap *pcpumap =3D NULL; + g_autoptr(virBitmap) pcpumap =3D NULL; int ret =3D -1; virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | @@ -2848,11 +2848,10 @@ testDomainPinEmulator(virDomainPtr dom, } virBitmapFree(def->cputune.emulatorpin); - def->cputune.emulatorpin =3D virBitmapNewCopy(pcpumap); + def->cputune.emulatorpin =3D g_steal_pointer(&pcpumap); ret =3D 0; cleanup: - virBitmapFree(pcpumap); virDomainObjEndAPI(&vm); return ret; } @@ -2868,7 +2867,7 @@ testDomainGetEmulatorPinInfo(virDomainPtr dom, virDomainObj *vm =3D NULL; virDomainDef *def =3D NULL; virBitmap *cpumask =3D NULL; - virBitmap *bitmap =3D NULL; + g_autoptr(virBitmap) bitmap =3D NULL; int hostcpus; int ret =3D -1; @@ -2898,7 +2897,6 @@ testDomainGetEmulatorPinInfo(virDomainPtr dom, ret =3D 1; cleanup: virDomainObjEndAPI(&vm); - virBitmapFree(bitmap); return ret; } @@ -3049,7 +3047,7 @@ static int testDomainGetVcpus(virDomainPtr domain, int hostcpus; int ret =3D -1; unsigned long long statbase; - virBitmap *allcpumap =3D NULL; + g_autoptr(virBitmap) allcpumap =3D NULL; if (!(privdom =3D testDomObjFromDomain(domain))) return -1; @@ -3102,7 +3100,6 @@ static int testDomainGetVcpus(virDomainPtr domain, ret =3D maxinfo; cleanup: - virBitmapFree(allcpumap); virDomainObjEndAPI(&privdom); return ret; } @@ -3523,7 +3520,7 @@ testDomainSetNumaParameters(virDomainPtr dom, { virDomainObj *vm =3D NULL; virDomainDef *def =3D NULL; - virBitmap *nodeset =3D NULL; + g_autoptr(virBitmap) nodeset =3D NULL; virDomainNumatuneMemMode config_mode; bool live; size_t i; @@ -3590,7 +3587,6 @@ testDomainSetNumaParameters(virDomainPtr dom, ret =3D 0; cleanup: - virBitmapFree(nodeset); virDomainObjEndAPI(&vm); return ret; } @@ -9669,7 +9665,7 @@ testDomainPinIOThread(virDomainPtr dom, virDomainObj *vm; virDomainDef *def; virDomainIOThreadIDDef *iothrid; - virBitmap *cpumask =3D NULL; + g_autoptr(virBitmap) cpumask =3D NULL; virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); @@ -9702,7 +9698,6 @@ testDomainPinIOThread(virDomainPtr dom, ret =3D 0; cleanup: - virBitmapFree(cpumask); virDomainObjEndAPI(&vm); return ret; } --=20 2.31.1