[libbluray-devel] Fix resource leak in error path
hpi1
git at videolan.org
Mon Sep 1 14:07:29 CEST 2014
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Aug 27 12:14:45 2014 +0300| [07e4b853ef7542c22dbf48768a0f3a36ed3a0d88] | committer: hpi1
Fix resource leak in error path
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=07e4b853ef7542c22dbf48768a0f3a36ed3a0d88
---
.../java/com/aacsla/bluray/online/ContentAttribute.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java b/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java
index 9a57eb7..d7bd947 100644
--- a/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java
+++ b/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java
@@ -27,17 +27,25 @@ public class ContentAttribute {
}
public byte[] getContentCertID() {
+ FileInputStream is = null;
try {
- FileInputStream is = new FileInputStream(
+ is = new FileInputStream(
System.getProperty("bluray.vfs.root") + File.separator + "AACS/Content000.cer");
is.skip(14);
byte[] bytes = new byte[6];
is.read(bytes, 0, 6);
- is.close();
return bytes;
} catch (Throwable e) {
e.printStackTrace();
return null;
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
}
}
}
More information about the libbluray-devel
mailing list