Browse Source

[infer] Fix a resource leak in PackWriter

Bug: 509385
Change-Id: Ic8a82895fa39be73f1bd8427cfe9437be6fc4e3e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.6
Matthias Sohn 8 years ago
parent
commit
f30fe13ac9
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java

3
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java

@ -1597,7 +1597,7 @@ public class PackWriter implements AutoCloseable {
} }
} }
TemporaryBuffer.Heap delta = delta(otp); try (TemporaryBuffer.Heap delta = delta(otp)) {
out.writeHeader(otp, delta.length()); out.writeHeader(otp, delta.length());
Deflater deflater = deflater(); Deflater deflater = deflater();
@ -1605,6 +1605,7 @@ public class PackWriter implements AutoCloseable {
DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater); DeflaterOutputStream dst = new DeflaterOutputStream(out, deflater);
delta.writeTo(dst, null); delta.writeTo(dst, null);
dst.finish(); dst.finish();
}
typeStats.cntDeltas++; typeStats.cntDeltas++;
typeStats.deltaBytes += out.length() - otp.getOffset(); typeStats.deltaBytes += out.length() - otp.getOffset();
} }

Loading…
Cancel
Save