Fix potential memory leaks on realtime client disconnect not clean up server properly

This commit is contained in:
Wu Cheng-Han 2016-07-13 10:41:49 +08:00
parent cb75424f8e
commit b3ba512cea
1 changed files with 2 additions and 0 deletions

View File

@ -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];
}
}