summaryrefslogtreecommitdiffstats
path: root/base/util/src/netscape/security/x509
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2016-11-03 02:40:41 +0100
committerEndi S. Dewata <edewata@redhat.com>2016-11-03 03:08:31 +0100
commit7a66902bfba413ffee5d05f89297e0bf9c0c39eb (patch)
treeb329e84e1845da5fa7764be3360e5a2c9acfb7b9 /base/util/src/netscape/security/x509
parent4ce9c6795de030d81779e46fae40af87e05b8af0 (diff)
downloadpki-7a66902bfba413ffee5d05f89297e0bf9c0c39eb.tar.gz
pki-7a66902bfba413ffee5d05f89297e0bf9c0c39eb.tar.xz
pki-7a66902bfba413ffee5d05f89297e0bf9c0c39eb.zip
Fixed resource leak in OtherName.
The OtherName has been modified to always close the DerOutputStream instances. https://fedorahosted.org/pki/ticket/2530
Diffstat (limited to 'base/util/src/netscape/security/x509')
-rw-r--r--base/util/src/netscape/security/x509/OtherName.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/base/util/src/netscape/security/x509/OtherName.java b/base/util/src/netscape/security/x509/OtherName.java
index ae8398344..a78c4fa7a 100644
--- a/base/util/src/netscape/security/x509/OtherName.java
+++ b/base/util/src/netscape/security/x509/OtherName.java
@@ -60,12 +60,14 @@ public class OtherName implements GeneralNameInterface {
decodeThis(derValue);
}
- public OtherName(ObjectIdentifier oid, byte data[]) {
+ public OtherName(ObjectIdentifier oid, byte data[]) throws IOException {
mOID = oid;
DerOutputStream dos = new DerOutputStream();
try {
dos.putDerValue(new DerValue(data));
} catch (IOException e) {
+ } finally {
+ dos.close();
}
mData = dos.toByteArray();
}
@@ -73,7 +75,7 @@ public class OtherName implements GeneralNameInterface {
/**
* Constructs a string-based other name.
*/
- public OtherName(ObjectIdentifier oid, byte tag, String value) {
+ public OtherName(ObjectIdentifier oid, byte tag, String value) throws IOException {
mOID = oid;
DerOutputStream dos = new DerOutputStream();
try {
@@ -87,16 +89,20 @@ public class OtherName implements GeneralNameInterface {
dos.putUTF8String(value);
}
} catch (IOException e) {
+ } finally {
+ dos.close();
}
mData = dos.toByteArray();
}
- public OtherName(ObjectIdentifier oid, String value) {
+ public OtherName(ObjectIdentifier oid, String value) throws IOException {
mOID = oid;
DerOutputStream dos = new DerOutputStream();
try {
dos.putPrintableString(value);
} catch (IOException e) {
+ } finally {
+ dos.close();
}
mData = dos.toByteArray();
}