summaryrefslogtreecommitdiff
path: root/proxy_lua.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2023-04-10 13:07:10 -0700
committerdormando <dormando@rydia.net>2023-04-10 13:07:10 -0700
commit8bcf3b45b7735b25d8d361b8342fab3b1dbb5755 (patch)
tree6d31c13e9cea9b7db8edceb1d04def56d7ba88a0 /proxy_lua.c
parent41be027140ac4c42564e472178e88ed149570fbd (diff)
downloadmemcached-8bcf3b45b7735b25d8d361b8342fab3b1dbb5755.tar.gz
proxy: fix backend leak with 2-arg mcp.pool()
When mcp.pool() is called in its two argument form, ie: mcp.pool({b1, b2}, { foo = bar }), backend objects would not be properly cached internally, causing objects to leak. Further, it was settings the objects into the cache table indexed by the object itself, so they would not be cleaned up by garbage collection. Bug was introduced as part of 6442017c (allow workers to run IO optionally)
Diffstat (limited to 'proxy_lua.c')
-rw-r--r--proxy_lua.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/proxy_lua.c b/proxy_lua.c
index 85de700..7f969c5 100644
--- a/proxy_lua.c
+++ b/proxy_lua.c
@@ -378,7 +378,7 @@ static mcp_backend_wrap_t *_mcplib_make_backendconn(lua_State *L, mcp_backend_la
}
#endif
- lua_pushvalue(L, 4); // push the label string back to the top.
+ lua_pushvalue(L, -2); // push the label string back to the top.
// Add this new backend connection to the object cache.
lua_pushvalue(L, -2); // copy the backend reference to the top.
// set our new backend wrapper object into the reference table.