[libbluray-devel] FontIndex: avoid leaking file descriptiors
hpi1
git at videolan.org
Wed Aug 27 10:48:46 CEST 2014
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Aug 26 13:47:23 2014 +0300| [6e7a17b4d460a122ca8f4401c0b6f07fb26ac0d6] | committer: hpi1
FontIndex: avoid leaking file descriptiors
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=6e7a17b4d460a122ca8f4401c0b6f07fb26ac0d6
---
src/libbluray/bdj/java/org/videolan/FontIndex.java | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/libbluray/bdj/java/org/videolan/FontIndex.java b/src/libbluray/bdj/java/org/videolan/FontIndex.java
index 84beb00..9eb856f 100644
--- a/src/libbluray/bdj/java/org/videolan/FontIndex.java
+++ b/src/libbluray/bdj/java/org/videolan/FontIndex.java
@@ -36,8 +36,9 @@ public class FontIndex extends DefaultHandler {
}
private FontIndex(String path) {
+ FileInputStream stream = null;
try {
- FileInputStream stream = new FileInputStream(path);
+ stream = new FileInputStream(path);
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse(stream, this);
} catch (FileNotFoundException e) {
@@ -46,6 +47,12 @@ public class FontIndex extends DefaultHandler {
e.printStackTrace();
} finally {
fontData = null;
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch (Exception e) {
+ }
+ }
}
}
More information about the libbluray-devel
mailing list