bugfix: double free

This commit is contained in:
Cloud Wu
2014-06-18 15:09:15 +08:00
parent c7887cceb7
commit 078ac2bcd2

View File

@@ -153,6 +153,8 @@ lunpackrequest(lua_State *L) {
static int
lpackresponse(lua_State *L) {
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);
size_t sz = luaL_checkunsigned(L, 3);
@@ -161,8 +163,6 @@ lpackresponse(lua_State *L) {
fill_uint32(buf+2, session);
memcpy(buf+6,msg,sz);
skynet_free(msg);
lua_pushlstring(L, (const char *)buf, sz+6);
return 1;