Skip to content

Commit b91221b

Browse files
authored
optimize: fix potential null pointer dereference found by coverity (openresty#2051)
deref_ptr: Directly dereferencing pointer ctx. 1143 *ctx = ngx_http_get_module_ctx(r, ngx_http_lua_module); CID 258020 (openresty#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 }
1 parent 381e9b3 commit b91221b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ngx_http_lua_pipe.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ ngx_http_lua_pipe_get_lua_ctx(ngx_http_request_t *r,
11411141
int rc;
11421142

11431143
*ctx = ngx_http_get_module_ctx(r, ngx_http_lua_module);
1144-
if (ctx == NULL) {
1144+
if (*ctx == NULL) {
11451145
return NGX_HTTP_LUA_FFI_NO_REQ_CTX;
11461146
}
11471147

0 commit comments

Comments
 (0)