mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-11 13:39:09 +00:00
Replace Dispose with Clear to make it compilable in Mono
Fix posible memory leak in HMac
This commit is contained in:
@@ -164,7 +164,7 @@ namespace Renci.SshNet.Security.Cryptography
|
||||
// Dispose managed ResourceMessages.
|
||||
if (this._hash != null)
|
||||
{
|
||||
this._hash.Dispose();
|
||||
this._hash.Clear();
|
||||
this._hash = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,5 +153,16 @@ namespace Renci.SshNet.Security.Cryptography
|
||||
this._outerPadding[i] ^= this.KeyValue[i];
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
if (this._hash != null)
|
||||
{
|
||||
this._hash.Clear();
|
||||
this._hash = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1218,13 +1218,13 @@ namespace Renci.SshNet
|
||||
// Dispose of old ciphers and hash algorithms
|
||||
if (this._serverMac != null)
|
||||
{
|
||||
this._serverMac.Dispose();
|
||||
this._serverMac.Clear();
|
||||
this._serverMac = null;
|
||||
}
|
||||
|
||||
if (this._clientMac != null)
|
||||
{
|
||||
this._clientMac.Dispose();
|
||||
this._clientMac.Clear();
|
||||
this._clientMac = null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user