Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix memory leak (JENKINS-15376)
  • Loading branch information
Wouter Born committed Sep 27, 2017
1 parent cccaf24 commit 1262258
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -69,6 +69,7 @@
import org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider;
import org.tmatesoft.svn.core.io.SVNRepository;
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.SVNLogClient;
import org.tmatesoft.svn.core.wc.SVNRevision;

Expand Down Expand Up @@ -176,6 +177,7 @@ public DescriptorImpl getDescriptor() {
List<String> dirs = new ArrayList<String>();

SVNRepository repo = null;
SVNClientManager clientManager = null;
try {
ISVNAuthenticationProvider authProvider = CredentialsSVNAuthenticationProviderImpl.createAuthenticationProvider(
context, getTagsDir(), getCredentialsId(), null, TaskListener.NULL
Expand All @@ -185,7 +187,8 @@ context, getTagsDir(), getCredentialsId(), null, TaskListener.NULL

repo = SVNRepositoryFactory.create(repoURL);
repo.setAuthenticationManager(authManager);
SVNLogClient logClient = new SVNLogClient(authManager, null);
clientManager = SVNClientManager.newInstance(null,authManager);
SVNLogClient logClient = clientManager.getLogClient();

if (isSVNRepositoryProjectRoot(repo)) {
dirs = this.getSVNRootRepoDirectories(logClient, repoURL);
Expand All @@ -203,6 +206,9 @@ context, getTagsDir(), getCredentialsId(), null, TaskListener.NULL
if (repo != null) {
repo.closeSession();
}
if (clientManager != null) {
clientManager.dispose();
}
}

// SVNKit's doList() method returns also the parent dir, so we need to remove it
Expand Down

0 comments on commit 1262258

Please sign in to comment.