From b01d28f9766c96ebe4d29b9e8cc0c24c689fc03f Mon Sep 17 00:00:00 2001 From: Thierry FOURNIER Date: Tue, 11 Jul 2017 18:38:39 +0200 Subject: [PATCH] BUG/MINOR: Lua: The socket may be destroyed when we try to access. When we try to access to other proxy context, we must check its existence because haproxy can kill it between the creation and the usage. This patch should be backported in 1.6 and 1.7 --- src/hlua.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/hlua.c b/src/hlua.c index 24e04f20d4..4299487155 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -2205,6 +2205,11 @@ __LJMP static int hlua_socket_connect(struct lua_State *L) /* Get args. */ socket = MAY_LJMP(hlua_checksocket(L, 1)); + + /* The socket may be destroy. */ + if (!socket->s) + return 0; + ip = MAY_LJMP(luaL_checkstring(L, 2)); if (lua_gettop(L) >= 3) port = MAY_LJMP(luaL_checkinteger(L, 3)); -- 2.47.2