From 9c3da3f353e6f1a0e9878ff0367621e844e6a5a3 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Tue, 24 May 2022 21:54:56 +0500 Subject: [PATCH] fix potential null pointer dereference found by coverity deref_ptr: Directly dereferencing pointer ctx. 1143 *ctx = ngx_http_get_module_ctx(r, ngx_http_lua_module); CID 258020 (#1 of 1): Dereference before null check (REVERSE_INULL)check_after_deref: Null-checking ctx suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 1144 if (ctx == NULL) { 1145 return NGX_HTTP_LUA_FFI_NO_REQ_CTX; 1146 } --- src/ngx_http_lua_pipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ngx_http_lua_pipe.c b/src/ngx_http_lua_pipe.c index 93dc7d5bc5..d0936c6d9e 100644 --- a/src/ngx_http_lua_pipe.c +++ b/src/ngx_http_lua_pipe.c @@ -1141,7 +1141,7 @@ ngx_http_lua_pipe_get_lua_ctx(ngx_http_request_t *r, int rc; *ctx = ngx_http_get_module_ctx(r, ngx_http_lua_module); - if (ctx == NULL) { + if (*ctx == NULL) { return NGX_HTTP_LUA_FFI_NO_REQ_CTX; }