SSH2: use weakreference when available to stop memory leak

This commit is contained in:
terrafrost 2021-06-19 10:14:45 -05:00
parent f1c4164687
commit e3df33183c

View File

@ -1123,7 +1123,7 @@ class SSH2
31 => 'NET_SSH2_MSG_KEX_ECDH_REPLY']
);
self::$connections[$this->getResourceId()] = $this;
self::$connections[$this->getResourceId()] = class_exists('WeakReference') ? \WeakReference::create($this) : $this;
if (is_resource($host)) {
$this->fsock = $host;