Replace Dispose with Clear to make it compilable in Mono

Fix posible memory leak in HMac
This commit is contained in:
olegkap_cp
2012-02-10 18:41:39 +00:00
parent 0203a453b0
commit 9f82f4bb4d
3 changed files with 14 additions and 3 deletions
@@ -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;
}
}
}
}
+2 -2
View File
@@ -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;
}