mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-26 19:40:28 +00:00
Call xml_parser_free and unset to avoid memory leaks
This commit is contained in:
parent
fce6063de6
commit
a276c2b073
@ -1415,9 +1415,14 @@ class Crypt_RSA
|
|||||||
xml_set_character_data_handler($xml, '_data_handler');
|
xml_set_character_data_handler($xml, '_data_handler');
|
||||||
// add <xml></xml> to account for "dangling" tags like <BitStrength>...</BitStrength> that are sometimes added
|
// add <xml></xml> to account for "dangling" tags like <BitStrength>...</BitStrength> that are sometimes added
|
||||||
if (!xml_parse($xml, '<xml>' . $key . '</xml>')) {
|
if (!xml_parse($xml, '<xml>' . $key . '</xml>')) {
|
||||||
|
xml_parser_free($xml);
|
||||||
|
unset($xml);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xml_parser_free($xml);
|
||||||
|
unset($xml);
|
||||||
|
|
||||||
return isset($this->components['modulus']) && isset($this->components['publicExponent']) ? $this->components : false;
|
return isset($this->components['modulus']) && isset($this->components['publicExponent']) ? $this->components : false;
|
||||||
// from PuTTY's SSHPUBK.C
|
// from PuTTY's SSHPUBK.C
|
||||||
case CRYPT_RSA_PRIVATE_FORMAT_PUTTY:
|
case CRYPT_RSA_PRIVATE_FORMAT_PUTTY:
|
||||||
|
Loading…
Reference in New Issue
Block a user