diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitHookChangesetCollector.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitHookChangesetCollector.java index b3b1f97467..58b7ea0d75 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitHookChangesetCollector.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/GitHookChangesetCollector.java @@ -189,6 +189,7 @@ public class GitHookChangesetCollector finally { IOUtil.close(converter); + GitUtil.release(walk); } return changesets; diff --git a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java index d107d00ec3..d47dea9440 100644 --- a/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java +++ b/scm-plugins/scm-git-plugin/src/main/java/sonia/scm/repository/spi/GitLogCommand.java @@ -114,6 +114,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand Changeset changeset = null; Repository gr = null; GitChangesetConverter converter = null; + RevWalk revWalk = null; try { @@ -121,7 +122,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand if (!gr.getAllRefs().isEmpty()) { - RevWalk revWalk = new RevWalk(gr); + revWalk = new RevWalk(gr); ObjectId id = GitUtil.getRevisionId(gr, revision); RevCommit commit = revWalk.parseCommit(id); @@ -143,6 +144,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand finally { IOUtil.close(converter); + GitUtil.release(revWalk); GitUtil.close(gr); } @@ -171,6 +173,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand ChangesetPagingResult changesets = null; GitChangesetConverter converter = null; + RevWalk revWalk = null; try { @@ -207,7 +210,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand endId = gr.resolve(request.getEndChangeset()); } - RevWalk revWalk = new RevWalk(gr); + revWalk = new RevWalk(gr); converter = new GitChangesetConverter(gr, revWalk); @@ -278,6 +281,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand finally { IOUtil.close(converter); + GitUtil.release(revWalk); } return changesets;