From e2108d922da89cceeae88f091d8be8c2ad05ad2b Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Mon, 20 Aug 2012 16:12:49 +0200 Subject: [PATCH] Close ByteArrayOutputStreams. Resolves issue 244. --- core/src/main/java/com/google/bitcoin/core/Transaction.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/main/java/com/google/bitcoin/core/Transaction.java b/core/src/main/java/com/google/bitcoin/core/Transaction.java index 115c11f2..e069f558 100644 --- a/core/src/main/java/com/google/bitcoin/core/Transaction.java +++ b/core/src/main/java/com/google/bitcoin/core/Transaction.java @@ -700,6 +700,7 @@ public class Transaction extends ChildMessage implements Serializable { bos.write(key.sign(hash.getBytes())); bos.write((hashType.ordinal() + 1) | (anyoneCanPay ? 0x80 : 0)); signatures[i] = bos.toByteArray(); + bos.close(); } catch (IOException e) { throw new RuntimeException(e); // Cannot happen. } @@ -767,6 +768,7 @@ public class Transaction extends ChildMessage implements Serializable { // Note that this is NOT reversed to ensure it will be signed correctly. If it were to be printed out // however then we would expect that it is IS reversed. Sha256Hash hash = new Sha256Hash(doubleDigest(bos.toByteArray())); + bos.close(); // Put the transaction back to how we found it. for (int i = 0; i < inputs.size(); i++) {