Fix memory leak, See #952

This commit is contained in:
Cloud Wu
2019-03-06 00:19:51 +08:00
parent 48e5c36b5e
commit 1d4308f33a
3 changed files with 6 additions and 2 deletions

View File

@@ -133,6 +133,7 @@ mc_remote(lua_State *L) {
lua_pushlightuserdata(L, pack->data);
lua_pushinteger(L, (lua_Integer)(pack->size));
skynet_free(pack);
skynet_free(ptr);
return 2;
}

View File

@@ -97,7 +97,10 @@ skynet.register_protocol {
unpack = function(msg, sz)
return mc.packremote(msg, sz)
end,
dispatch = publish,
dispatch = function (...)
skynet.ignoreret()
publish(...)
end,
}
-- publish a message, if the caller is remote, forward the message to the owner node (by remote_publish)