Browse Source

[infer] Fix resource leak in DirCache

Bug: 509385
Change-Id: I5f914c910ef3a7583594fb31c7757d3dddf6a05e
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.6
Matthias Sohn 8 years ago
parent
commit
1779fb4a57
  1. 6
      org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java

6
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCache.java vendored

@ -634,9 +634,9 @@ public class DirCache {
public void write() throws IOException {
final LockFile tmp = myLock;
requireLocked(tmp);
try {
writeTo(liveFile.getParentFile(),
new BufferedOutputStream(tmp.getOutputStream()));
try (OutputStream o = tmp.getOutputStream();
OutputStream bo = new BufferedOutputStream(o)) {
writeTo(liveFile.getParentFile(), bo);
} catch (IOException err) {
tmp.unlock();
throw err;

Loading…
Cancel
Save