From b3ba512ceafdf6f6945bc82123fea641b3077570 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Wed, 13 Jul 2016 10:41:49 +0800 Subject: [PATCH] Fix potential memory leaks on realtime client disconnect not clean up server properly --- lib/realtime.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/realtime.js b/lib/realtime.js index 2540533..8ff857e 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -478,6 +478,7 @@ function disconnect(socket) { if (note.server.isDirty) { updateNote(note, function (err, _note) { if (err) return logger.error('disconnect note failed: ' + err); + delete note.server; delete notes[noteId]; if (config.debug) { //logger.info(notes); @@ -487,6 +488,7 @@ function disconnect(socket) { } }); } else { + delete note.server; delete notes[noteId]; } }