summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWu Cheng-Han2016-07-13 10:41:49 +0800
committerWu Cheng-Han2016-07-13 10:41:49 +0800
commitb3ba512ceafdf6f6945bc82123fea641b3077570 (patch)
treea75afdab44f419cde7a91cc0a94a94a329318d95 /lib
parentcb75424f8ea8c164c3762136b6c38eedf189f66a (diff)
Fix potential memory leaks on realtime client disconnect not clean up server properly
Diffstat (limited to 'lib')
-rw-r--r--lib/realtime.js2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/realtime.js b/lib/realtime.js
index 25405338..8ff857e1 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];
}
}