mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-23 15:19:36 -04:00
BUG/MINOR: lua: check buffers before initializing socket
When a socket is initilized in the body context, a segfaut is generated because the memory pools are not initilized. This atch check if these memory pool are initialized.
This commit is contained in:
parent
d2b597aa10
commit
4a6170cce1
1 changed files with 6 additions and 0 deletions
|
|
@ -1731,6 +1731,12 @@ __LJMP static int hlua_socket_new(lua_State *L)
|
|||
socket = MAY_LJMP(lua_newuserdata(L, sizeof(*socket)));
|
||||
memset(socket, 0, sizeof(*socket));
|
||||
|
||||
/* Check if the various memory pools are intialized. */
|
||||
if (!pool2_session || !pool2_channel || !pool2_buffer) {
|
||||
hlua_pusherror(L, "socket: uninitialized pools.");
|
||||
goto out_fail_conf;
|
||||
}
|
||||
|
||||
/* Pop a class session metatable and affect it to the userdata. */
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, class_socket_ref);
|
||||
lua_setmetatable(L, -2);
|
||||
|
|
|
|||
Loading…
Reference in a new issue