From f1c278915d4ae784a2373b41dadba7d6283fb4d3 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Sat, 8 Jun 2013 14:46:34 +0200 Subject: [PATCH] Possible fix for memory leak --- src/Player.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Player.php b/src/Player.php index 3f3a3b534d..48749a9791 100644 --- a/src/Player.php +++ b/src/Player.php @@ -253,6 +253,8 @@ class Player{ unset($this->buffer); $this->recovery = null; unset($this->recovery); + $this->queue = null; + unset($this->queue); $this->connected = false; $this->server->interface->stopChunked($this->CID); if($msg === true and $this->username != ""){ @@ -1611,12 +1613,18 @@ class Player{ if(isset($this->queue[$this->counter[1] + 1])){ $d = $this->queue[$this->counter[1] + 1]; + $this->queue[$this->counter[1] + 1] = null; unset($this->queue[$this->counter[1] + 1]); $this->handle($d[0], $d[1]); - }elseif(count($this->queue) > 25){ + }elseif(($cnt = count($this->queue)) > 25){ + if($cnt >= 1024){ + $this->close("end of stream"); + break; + } $q = array_shift($this->queue); $this->counter[1] = $q[1][0]; $this->handle($q[0], $q[1]); + } break; }