From 31d98de6b77120492407b86301174282822a11d5 Mon Sep 17 00:00:00 2001 From: Rene Peinthor Date: Fri, 1 May 2026 12:34:14 +0200 Subject: [PATCH] linstor: Fix a file handle resource leak opening template.properties --- .../cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java b/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java index 2b11c83c8021..77953a32e63a 100644 --- a/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java +++ b/plugins/storage/volume/linstor/src/main/java/com/cloud/hypervisor/kvm/storage/LinstorStorageAdaptor.java @@ -585,8 +585,8 @@ private static boolean isSystemTemplate(KVMPhysicalDisk disk) { Path propFile = diskPath.getParent().resolve("template.properties"); if (Files.exists(propFile)) { java.util.Properties templateProps = new java.util.Properties(); - try { - templateProps.load(new FileInputStream(propFile.toFile())); + try (FileInputStream in = new FileInputStream(propFile.toFile())) { + templateProps.load(in); String desc = templateProps.getProperty("description"); if (desc != null && desc.startsWith("SystemVM Template")) { return true;