Fix memory leak on authentication error

The root cause of this is in the jCIFS library but this mitigates the
problem.

* Upgrade jCIFS library to version 2.1.19

* Added author comments
This commit is contained in:
Adam Jones
2020-06-24 16:41:56 +01:00
committed by GitHub
parent 48c27e3fea
commit 13f528205e
3 changed files with 11 additions and 1 deletions

View File

@@ -42,7 +42,7 @@ compileTestJava {
ext {
idPrefix = 'smb'
jcifsVersion = '2.1.11'
jcifsVersion = '2.1.19'
log4jVersion = '2.12.1'
springIntegrationVersion = '5.2.1.RELEASE'

View File

@@ -55,6 +55,7 @@ import jcifs.smb.SmbFileOutputStream;
* @author Artem Bilan
* @author Prafull Kumar Soni
* @author Gregory Bragg
* @author Adam Jones
*
*/
public class SmbSession implements Session<SmbFile> {

View File

@@ -39,6 +39,7 @@ import jcifs.smb.SmbFile;
/**
* @author Markus Spann
* @author Gregory Bragg
* @author Adam Jones
*/
public class SmbShare extends SmbFile {
@@ -115,6 +116,14 @@ public class SmbShare extends SmbFile {
canRead = canRead();
}
catch (SmbException _ex) {
if (this.closeContext.get()) {
try {
getContext().close();
}
catch (CIFSException e) {
logger.error("Unable to close share: " + this);
}
}
throw new NestedIOException("Unable to initialize share: " + this, _ex);
}
Assert.isTrue(canRead, "Share is not accessible " + this);