F-13481: close the keystore input stream on load failures in loadKeyStoreFileByType

pull/418/head
Chris Conlon 2026-09-17 14:21:51 -06:00
parent 537254ec10
commit e785be5c46
1 changed files with 7 additions and 1 deletions

View File

@ -777,11 +777,17 @@ public class WolfSSLUtil {
stream = new FileInputStream(file);
ks.load(stream, pass);
stream.close();
} catch (KeyStoreException | IOException | NoSuchAlgorithmException |
CertificateException e) {
return null;
} finally {
try {
if (stream != null) {
stream.close();
}
} catch (IOException e) {
}
}
return ks;