mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
bugfix: double free
This commit is contained in:
@@ -153,6 +153,8 @@ lunpackrequest(lua_State *L) {
|
|||||||
static int
|
static int
|
||||||
lpackresponse(lua_State *L) {
|
lpackresponse(lua_State *L) {
|
||||||
uint32_t session = luaL_checkunsigned(L,1);
|
uint32_t session = luaL_checkunsigned(L,1);
|
||||||
|
// clusterd.lua:command.socket call lpackresponse,
|
||||||
|
// and the msg/sz is return by skynet.rawcall , so don't free(msg)
|
||||||
void * msg = lua_touserdata(L,2);
|
void * msg = lua_touserdata(L,2);
|
||||||
size_t sz = luaL_checkunsigned(L, 3);
|
size_t sz = luaL_checkunsigned(L, 3);
|
||||||
|
|
||||||
@@ -161,8 +163,6 @@ lpackresponse(lua_State *L) {
|
|||||||
fill_uint32(buf+2, session);
|
fill_uint32(buf+2, session);
|
||||||
memcpy(buf+6,msg,sz);
|
memcpy(buf+6,msg,sz);
|
||||||
|
|
||||||
skynet_free(msg);
|
|
||||||
|
|
||||||
lua_pushlstring(L, (const char *)buf, sz+6);
|
lua_pushlstring(L, (const char *)buf, sz+6);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user