mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
BUILD: lua: silence some compiler warnings about potential null derefs (#2)
Here we make sure that appctx is always taken from the unchecked value since we know it's an appctx, which explains why it's immediately dereferenced. A missing test was added to ensure that task_new() does not return a NULL. This may be backported to 1.8.
This commit is contained in:
parent
526aed219f
commit
e09101e8d9
@ -2361,7 +2361,7 @@ __LJMP static int hlua_socket_connect_yield(struct lua_State *L, int status, lua
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
appctx = objt_appctx(s->si[0].end);
|
appctx = __objt_appctx(s->si[0].end);
|
||||||
|
|
||||||
/* Check for connection established. */
|
/* Check for connection established. */
|
||||||
if (appctx->ctx.hlua_cosocket.connected) {
|
if (appctx->ctx.hlua_cosocket.connected) {
|
||||||
@ -2473,7 +2473,7 @@ __LJMP static int hlua_socket_connect(struct lua_State *L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hlua = hlua_gethlua(L);
|
hlua = hlua_gethlua(L);
|
||||||
appctx = objt_appctx(s->si[0].end);
|
appctx = __objt_appctx(s->si[0].end);
|
||||||
|
|
||||||
/* inform the stream that we want to be notified whenever the
|
/* inform the stream that we want to be notified whenever the
|
||||||
* connection completes.
|
* connection completes.
|
||||||
@ -5723,6 +5723,9 @@ static int hlua_register_task(lua_State *L)
|
|||||||
WILL_LJMP(luaL_error(L, "Lua out of memory error."));
|
WILL_LJMP(luaL_error(L, "Lua out of memory error."));
|
||||||
|
|
||||||
task = task_new(MAX_THREADS_MASK);
|
task = task_new(MAX_THREADS_MASK);
|
||||||
|
if (!task)
|
||||||
|
WILL_LJMP(luaL_error(L, "Lua out of memory error."));
|
||||||
|
|
||||||
task->context = hlua;
|
task->context = hlua;
|
||||||
task->process = hlua_process_task;
|
task->process = hlua_process_task;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user