mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-12 08:26:30 +00:00
PrimeField: plug memory leaks
This commit is contained in:
parent
8186db7533
commit
05539a72be
@ -111,4 +111,12 @@ class PrimeField extends FiniteField
|
||||
{
|
||||
return Integer::getModulo($this->instanceID)->getLength();
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
Integer::cleanupCache($this->instanceID);
|
||||
}
|
||||
}
|
@ -95,6 +95,15 @@ class Integer extends Base
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the modulo for a given instance
|
||||
*/
|
||||
public static function cleanupCache($instanceID)
|
||||
{
|
||||
unset(static::$modulo[$instanceID]);
|
||||
unset(static::$reduce[$instanceID]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the modulo
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user