From nobody Sun Feb 8 18:09:08 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=1639052582; cv=none; d=zohomail.com; s=zohoarc; b=ZZ53n/19Z5wnaPnqRvCmMy49el6HlEqc4DnLmv/br9Q6EwXpZajqfxpacitxDLw0h+z5d1AOG86BLudB8f1VYKATVT65fAaFMc+nV9YjqAjItnYZZV1kSLGkOxsekzvfK9ZI2k+mqMoAzBDTicRn3eAEQ87IazPnV2m4POfJHmo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639052582; 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=/0GumRd/DWnZINN+IA9CvmZXIMQSw+VzWdKnOWt9Z+A=; b=SjGnKIY/y4Dv0gdOop0EbRDAevppbFNkXMk+yFiYqOFUqsFItwd1kIbxN0JJkcYbRZX4LAuUzfh0BXA70A+cJfYtw6LtUY2YJbpzbnlRvltfOOc2LGlW6JugAz58QtEAZRjwLXDpVYccASUud2K2xwkJKG/DFgus3ElQl6G2cj0= 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 16390525824281008.7504716603572; Thu, 9 Dec 2021 04:23:02 -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-599-iBc1ad-qOTuFoJp7hvp6lg-1; Thu, 09 Dec 2021 07:22:41 -0500 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 7434D81CCBA; Thu, 9 Dec 2021 12:22:35 +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 54C83100EBAD; Thu, 9 Dec 2021 12:22:35 +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 EB3344A707; Thu, 9 Dec 2021 12:22:34 +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 1B9CMVTY015730 for ; Thu, 9 Dec 2021 07:22:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id CCB3B17CD9; Thu, 9 Dec 2021 12:22:31 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 383A55E24E for ; Thu, 9 Dec 2021 12:22:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1639052581; 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=/0GumRd/DWnZINN+IA9CvmZXIMQSw+VzWdKnOWt9Z+A=; b=aA6QSI2sp+VsW1Omw4fb4Mln2FWkNDJ6BMh2HJBkkUX+r0gyzf/Is6Tgs1EaNU78vKFDf6 LXcmwsUT1c2ye7hpMR4kvipPJtXDDsVVzAA66QEyqH0vDM8bCOBS84n2agHn6XPXJJEhUS Yz9B5GambppZk6/xPfkM/6QbSy9Sc14= X-MC-Unique: iBc1ad-qOTuFoJp7hvp6lg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 32/36] lxc_controller: Use automatic memory freeing for virBitmap Date: Thu, 9 Dec 2021 13:18:37 +0100 Message-Id: <09df8959068a5ed0f31f7df226b392dee3ebc6d3.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.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: 1639052582843100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/lxc/lxc_controller.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 039efcd7c7..ae1f090077 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -731,7 +731,7 @@ static int virLXCControllerSetupLoopDevices(virLXCContr= oller *ctrl) static int virLXCControllerSetupCpuAffinity(virLXCController *ctrl) { int hostcpus, maxcpu =3D CPU_SETSIZE; - virBitmap *cpumap; + g_autoptr(virBitmap) cpumap =3D NULL; virBitmap *cpumapToSet; VIR_DEBUG("Setting CPU affinity"); @@ -761,11 +761,8 @@ static int virLXCControllerSetupCpuAffinity(virLXCCont= roller *ctrl) * so use '0' to indicate our own process ID. No threads are * running at this point */ - if (virProcessSetAffinity(0 /* Self */, cpumapToSet, false) < 0) { - virBitmapFree(cpumap); + if (virProcessSetAffinity(0 /* Self */, cpumapToSet, false) < 0) return -1; - } - virBitmapFree(cpumap); return 0; } @@ -810,7 +807,7 @@ static int virLXCControllerGetNumadAdvice(virLXCControl= ler *ctrl, */ static int virLXCControllerSetupResourceLimits(virLXCController *ctrl) { - virBitmap *auto_nodeset =3D NULL; + g_autoptr(virBitmap) auto_nodeset =3D NULL; int ret =3D -1; virBitmap *nodeset =3D NULL; virDomainNumatuneMemMode mode; @@ -841,7 +838,6 @@ static int virLXCControllerSetupResourceLimits(virLXCCo= ntroller *ctrl) ret =3D 0; cleanup: - virBitmapFree(auto_nodeset); return ret; } @@ -852,7 +848,7 @@ static int virLXCControllerSetupResourceLimits(virLXCCo= ntroller *ctrl) */ static int virLXCControllerSetupCgroupLimits(virLXCController *ctrl) { - virBitmap *auto_nodeset =3D NULL; + g_autoptr(virBitmap) auto_nodeset =3D NULL; int ret =3D -1; virBitmap *nodeset =3D NULL; size_t i; @@ -884,7 +880,6 @@ static int virLXCControllerSetupCgroupLimits(virLXCCont= roller *ctrl) ret =3D 0; cleanup: - virBitmapFree(auto_nodeset); return ret; } --=20 2.31.1