From 94ff41c19df1710ee22e8c63dcf10e6a17d3eac3 Mon Sep 17 00:00:00 2001 From: "Dmitry E. Oboukhov" <unera@debian.org> Date: Wed, 4 Sep 2013 16:47:17 +0400 Subject: [PATCH] Fixed memory leak in box.ipc.channel. --- src/lua/ipc.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/lua/ipc.cc b/src/lua/ipc.cc index 86799b5372..fd7516d7cc 100644 --- a/src/lua/ipc.cc +++ b/src/lua/ipc.cc @@ -149,13 +149,21 @@ lbox_ipc_channel_put(struct lua_State *L) lua_pushnumber(L, rid); lua_pushvalue(L, 2); lua_settable(L, -4); - lua_settop(L, top); - if (ipc_channel_put_timeout(ch, (void *)rid, timeout) == 0) - lua_pushboolean(L, 1); - else - lua_pushboolean(L, 0); + int retval; + if (ipc_channel_put_timeout(ch, (void *)rid, timeout) == 0) { + retval = 1; + } else { + /* put timeout */ + retval = 0; + lua_pushnumber(L, rid); + lua_pushnil(L); + lua_settable(L, -4); + } + + lua_settop(L, top); + lua_pushboolean(L, retval); return 1; } -- GitLab