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. 15
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java

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

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

Loading…
Cancel
Save