linstor: Fix a file handle resource leak opening template.properties (#13091)

This commit is contained in:
Rene Peinthor 2026-05-04 11:13:06 +02:00 committed by GitHub
parent 519715e81a
commit 5b9a3d7d32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -585,8 +585,8 @@ public class LinstorStorageAdaptor implements StorageAdaptor {
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;