From nobody Fri May 3 03:52:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1603849719; cv=none; d=zohomail.com; s=zohoarc; b=FY49UmTOeLyXNrieArasQKHjdOYM9deLotzz9VNU0vcQTiLIaOR+kNeTutE1GTsU2oxXjzk4L1AzAZqLaxEA7qKKcI9cdVaixTbvjlim00+pwVKTzxRuynlRHCGPCXrpEjexOkRhEfU+E5Lrf0Mon/5uii1J1UjzU9Ibd+yfaKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603849719; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=+C26iSXNqR8YTgNPO4d0cjtIDOP0fJg2Yfc8W1bpFHk=; b=eZijiAkntPgiAKALpAMBBkTgvaeyAPd+TtKxlKzs9GaloWsVOVbKfIbCEW4UCs31Wrr6+wAhPfOq5dTfhiOkFZXpsU96fbI31nGz3nhhA19pPfs62JflEtTYdRl0X46hhfCevkjL5tfLiU3ws6FQh5IEoH6xbs2CDlHxcYG5pm0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1603849719498727.9296379806342; Tue, 27 Oct 2020 18:48:39 -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-558-d16yRsWVO12XU0z5miexfQ-1; Tue, 27 Oct 2020 21:48:36 -0400 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 2C7151868411; Wed, 28 Oct 2020 01:48:31 +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 073FA5D9E8; Wed, 28 Oct 2020 01:48: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 3F52E1832FB7; Wed, 28 Oct 2020 01:48:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09S1l60Z030928 for ; Tue, 27 Oct 2020 21:47:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2D2426EF50; Wed, 28 Oct 2020 01:47:06 +0000 (UTC) Received: from vhost2.laine.org (ovpn-113-144.phx2.redhat.com [10.3.113.144]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3F216EF40 for ; Wed, 28 Oct 2020 01:47:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1603849718; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=+C26iSXNqR8YTgNPO4d0cjtIDOP0fJg2Yfc8W1bpFHk=; b=Cs/doM+Inpc8slN8VD37b5+i1DPP20ZDkK+COny5X72Vsy1SuMwgt1BJzTJVznrBI3o66A s5qoRVCDQnq02S4ZldL4o/loxJezkBZniocAhYrUCyUWKkNXZqhY8pRF5Hre0ZJ/L7KOrS ZT6iwVjeDtttJxdTC/xYJ91GMKgzsUk= X-MC-Unique: d16yRsWVO12XU0z5miexfQ-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH] node_device: fix leak of DIR* Date: Tue, 27 Oct 2020 21:46:59 -0400 Message-Id: <20201028014659.435453-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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) Content-Type: text/plain; charset="utf-8" Commit 53aec799fa31 introduced the function udevGetVDPACharDev(), which scans a directory using virDirOpenIfExists() and virDirRead(). It unfortunately forgets to close the DIR* when it is finished with it. This patch fixes that omission. Signed-off-by: Laine Stump Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko --- src/node_device/node_device_udev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index b1b8427c05..ec0bf9192b 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1162,6 +1162,7 @@ udevGetVDPACharDev(const char *sysfs_path, virReportError(VIR_ERR_INTERNAL_ERROR, _("vDPA chardev path '%s' does not exist"), chardev); + VIR_DIR_CLOSE(dir); return -1; } VIR_DEBUG("vDPA chardev is at '%s'", chardev); @@ -1171,6 +1172,8 @@ udevGetVDPACharDev(const char *sysfs_path, } } =20 + VIR_DIR_CLOSE(dir); + if (direrr < 0) return -1; =20 --=20 2.26.2