fix(memleak): temp, wonky fix to #4079 . Sets closure vars user to

null in api.batchUpdate(). More will be needed
This commit is contained in:
Tyler Renelle 2014-10-01 15:43:50 -06:00
parent bf662ff119
commit ead42e7cef

View file

@ -444,14 +444,17 @@ api.batchUpdate = function(req, res, next) {
});
// call all the operations, then return the user object to the requester
async.waterfall(ops, function(err,user) {
async.waterfall(ops, function(err,_user) {
res.json = oldJson;
res.send = oldSend;
if (err) return next(err);
var response = user.toJSON();
var response = _user.toJSON();
response.wasModified = res.locals.wasModified;
user.fns.nullify();
user = res.locals.user = oldSend = oldJson = oldSave = null;
// return only drops & streaks
if (response._tmp && response._tmp.drop){
res.json(200, {_tmp: {drop: response._tmp.drop}, _v: response._v});