Skip to content

Commit

Permalink
Fixed resource leak in GenericASN1Extension.
Browse files Browse the repository at this point in the history
The GenericASN1Extension has been modified to always close the
DerOutputStream instance.

https://fedorahosted.org/pki/ticket/2530
  • Loading branch information
edewata committed Nov 3, 2016
1 parent 7a66902 commit 487d08c
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -87,7 +87,6 @@ private void encodeThis()
// Encode pattern
private byte[] encodePattern()
throws IOException, ParseException {
DerOutputStream os = new DerOutputStream();
DerOutputStream tmp = new DerOutputStream();
String type = null;
String value = null;
Expand All @@ -101,8 +100,10 @@ private byte[] encodePattern()
tmp.putDerValue(new DerValue(buff));
break;
case '}':
os.write(DerValue.tag_Sequence, tmp);
return os.toByteArray();
try (DerOutputStream os = new DerOutputStream()) {
os.write(DerValue.tag_Sequence, tmp);
return os.toByteArray();
}
default:
type = mConfig.get(PROP_ATTRIBUTE + "." + ch + "." + PROP_TYPE);
if (type.equalsIgnoreCase("integer")) {
Expand Down

0 comments on commit 487d08c

Please sign in to comment.