From 1d4308f33af66269faf11dd29ee91315aeb599ea Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Wed, 6 Mar 2019 00:19:51 +0800 Subject: [PATCH] Fix memory leak, See #952 --- 3rd/jemalloc | 2 +- lualib-src/lua-multicast.c | 1 + service/multicastd.lua | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/3rd/jemalloc b/3rd/jemalloc index 61efbda7..896ed3a8 160000 --- a/3rd/jemalloc +++ b/3rd/jemalloc @@ -1 +1 @@ -Subproject commit 61efbda7098de6fe64c362d309824864308c36d4 +Subproject commit 896ed3a8b3f41998d4fb4d625d30ac63ef2d51fb diff --git a/lualib-src/lua-multicast.c b/lualib-src/lua-multicast.c index 8903b36e..4588bd10 100644 --- a/lualib-src/lua-multicast.c +++ b/lualib-src/lua-multicast.c @@ -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; } diff --git a/service/multicastd.lua b/service/multicastd.lua index bcc5ea97..a00eb3d2 100644 --- a/service/multicastd.lua +++ b/service/multicastd.lua @@ -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)