Skip to content

Commit c5b3410

Browse files
bugfix: supress clang warning.
../ngx_stream_lua-0.0.18RC1/src/ngx_stream_lua_proxy_ssl_certby.c:66:25: warning: variable 'ssl' may be uninitialized when used here [-Wconditional-uninitialized] 66 | SSL_CTX_set_cert_cb(ssl->ctx, ngx_stream_lua_proxy_ssl_cert_handler, NULL); | ^~~ ../ngx_stream_lua-0.0.18RC1/src/ngx_stream_lua_proxy_ssl_certby.c:33:29: note: initialize the variable 'ssl' to silence this warning 33 | ngx_ssl_t *ssl; | ^ | = NULL
1 parent 59c749f commit c5b3410

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

src/ngx_stream_lua_proxy_ssl_certby.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ static ngx_int_t ngx_stream_lua_proxy_ssl_cert_by_chunk(lua_State *L,
2828
ngx_int_t
2929
ngx_stream_lua_proxy_ssl_cert_set_callback(ngx_conf_t *cf)
3030
{
31-
ngx_flag_t proxy_ssl = 0;
3231
ngx_pool_cleanup_t *cln;
3332
ngx_ssl_t *ssl;
3433
void *pscf;
@@ -49,23 +48,17 @@ ngx_stream_lua_proxy_ssl_cert_set_callback(ngx_conf_t *cf)
4948
pscf = ngx_stream_conf_get_module_srv_conf(cf, ngx_stream_proxy_module);
5049
if (pscf == ngx_ssl_get_server_conf(ssl->ctx)) {
5150
/* here we make sure that ssl is pscf->ssl */
52-
proxy_ssl = 1;
53-
54-
break;
51+
SSL_CTX_set_cert_cb(ssl->ctx,
52+
ngx_stream_lua_proxy_ssl_cert_handler, NULL);
53+
return NGX_OK;
5554
}
5655
}
5756

58-
if (!proxy_ssl) {
59-
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
60-
"proxy_ssl_certificate_by_lua* should be used with "
61-
"proxy_ssl directive");
62-
63-
return NGX_ERROR;
64-
}
57+
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
58+
"proxy_ssl_certificate_by_lua* should be used with "
59+
"proxy_ssl directive");
6560

66-
SSL_CTX_set_cert_cb(ssl->ctx, ngx_stream_lua_proxy_ssl_cert_handler, NULL);
67-
68-
return NGX_OK;
61+
return NGX_ERROR;
6962
}
7063

7164

0 commit comments

Comments
 (0)