From 83bdbc1cce8657629602163aac79f24e9277e0ab Mon Sep 17 00:00:00 2001 From: Israel Lot Date: Tue, 24 Jan 2017 23:02:06 -0200 Subject: [PATCH] Fix memory leak The Request.create creates a new Request object by calling new Request(), which would trigger another insertion on the array of a request will a null name, which would never get removed. --- src/please.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/please.js b/src/please.js index aee7f11..f582327 100644 --- a/src/please.js +++ b/src/please.js @@ -522,12 +522,14 @@ Request.prototype = { init: function (name) { $.extend(this, $.Deferred()); - this.id = lastRequestId++; - this.name = name; - this.data = Array.prototype.slice.call(arguments); this.type = 'request'; - requests[this.id] = this; + if (name !== null) { + this.id = lastRequestId++; + this.name = name; + this.data = Array.prototype.slice.call(arguments); + requests[this.id] = this; + } }, /**