From 695509b1b303cd99cf2e75ab6b7b406179a1ee60 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Fri, 27 Jan 2017 18:10:07 -0800 Subject: [PATCH] peer: fix potential memory leak. --- lib/net/peer.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/net/peer.js b/lib/net/peer.js index d628ac8a..57aa71e0 100644 --- a/lib/net/peer.js +++ b/lib/net/peer.js @@ -1504,7 +1504,8 @@ Peer.prototype.readPacket = co(function* readPacket(packet) { this.socket.pause(); yield this.handlePacket(packet); } finally { - this.socket.resume(); + if (!this.destroyed) + this.socket.resume(); } break; default: @@ -1513,7 +1514,8 @@ Peer.prototype.readPacket = co(function* readPacket(packet) { this.socket.pause(); yield this.handlePacket(packet); } finally { - this.socket.resume(); + if (!this.destroyed) + this.socket.resume(); unlock(); } break;