Browse Source

[infer] Fix resource leaks in DfsInserter

Bug: 509385
Change-Id: Id5dc40bb3fb9da97ea0795cca1f2bcdcde347767
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.6
Matthias Sohn 8 years ago
parent
commit
6cbc99d3ee
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java

7
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsInserter.java

@ -312,8 +312,7 @@ public class DfsInserter extends ObjectInserter {
}
DfsOutputStream os = db.writeFile(pack, INDEX);
try {
CountingOutputStream cnt = new CountingOutputStream(os);
try (CountingOutputStream cnt = new CountingOutputStream(os)) {
if (buf != null)
buf.writeTo(cnt, null);
else
@ -321,7 +320,9 @@ public class DfsInserter extends ObjectInserter {
pack.addFileExt(INDEX);
pack.setFileSize(INDEX, cnt.getCount());
} finally {
os.close();
if (buf != null) {
buf.close();
}
}
return packIndex;
}

Loading…
Cancel
Save