diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2016-12-20 01:08:38 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2016-12-21 00:50:21 +0100 |
commit | 325cb35ccd6108eaf9e6c3ec6343ca6988f10a21 (patch) | |
tree | aa5bbd67d0be9cf57021ac20b5a2cc38d63fcb80 /org.eclipse.jgit | |
parent | f30fe13ac94df9de77c18813f41c29fe7f55a44f (diff) | |
download | jgit-325cb35ccd6108eaf9e6c3ec6343ca6988f10a21.tar.gz jgit-325cb35ccd6108eaf9e6c3ec6343ca6988f10a21.zip |
[infer] Fix resource leak in ObjectChecker
Bug: 509385
Change-Id: I6b6ff5b721d959eb0708003a40c8f97d6826ac46
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java index 0b5efd77d4..feecbd81c0 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectChecker.java @@ -709,11 +709,12 @@ public class ObjectChecker { return ptr; } - @SuppressWarnings("resource") @Nullable private ObjectId idFor(int objType, byte[] raw) { if (skipList != null) { - return new ObjectInserter.Formatter().idFor(objType, raw); + try (ObjectInserter.Formatter fmt = new ObjectInserter.Formatter()) { + return fmt.idFor(objType, raw); + } } return null; } |