Browse Source

Fix overflow stream leak during merge conflicts

When reading back from an overflowed TemporaryBuffer the InputStream
must be closed to close the FileInputStream that is reading from
the backing file.

Change-Id: Id83d8f16f5b2c2618a9f841ec3508508455a6ae1
stable-4.1
Shawn Pearce 10 years ago
parent
commit
e4433e5e37
  1. 5
      org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java

5
org.eclipse.jgit/src/org/eclipse/jgit/merge/ResolveMerger.java

@ -810,8 +810,9 @@ public class ResolveMerger extends ThreeWayMerger {
new MergeFormatter().formatMerge(buf, result, new MergeFormatter().formatMerge(buf, result,
Arrays.asList(commitNames), CHARACTER_ENCODING); Arrays.asList(commitNames), CHARACTER_ENCODING);
buf.close(); buf.close();
return getObjectInserter().insert(OBJ_BLOB, buf.length(), try (InputStream in = buf.openInputStream()) {
buf.openInputStream()); return getObjectInserter().insert(OBJ_BLOB, buf.length(), in);
}
} finally { } finally {
buf.destroy(); buf.destroy();
} }

Loading…
Cancel
Save