BUILD: ech: fix clang warnings

No impact as the state is either SHOW_ECH_SPECIFIC or SHOW_ECH_ALL but
never anything else.

src/ech.c:240:6: error: variable 'p' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  240 |         if (ctx->state == SHOW_ECH_ALL) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/ech.c:275:12: note: uninitialized use occurs here
  275 |         ctx->pp = p;
      |                   ^
src/ech.c:240:2: note: remove the 'if' if its condition is always true
  240 |         if (ctx->state == SHOW_ECH_ALL) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ech.c:228:17: note: initialize the variable 'p' to silence this warning
  228 |         struct proxy *p;
      |                        ^
      |                         = NULL
src/ech.c:240:6: error: variable 'bind_conf' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
  240 |         if (ctx->state == SHOW_ECH_ALL) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/ech.c:276:11: note: uninitialized use occurs here
  276 |         ctx->b = bind_conf;
      |                  ^~~~~~~~~
src/ech.c:240:2: note: remove the 'if' if its condition is always true
  240 |         if (ctx->state == SHOW_ECH_ALL) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/ech.c:229:29: note: initialize the variable 'bind_conf' to silence this warning
  229 |         struct bind_conf *bind_conf;
      |                                    ^
      |                                     = NULL
2 errors generated.
make: *** [Makefile:1062: src/ech.o] Error 1
This commit is contained in:
William Lallemand 2025-11-14 11:35:38 +01:00
parent e17881128b
commit bf639e581d

View File

@ -225,8 +225,8 @@ static int cli_io_handler_ech_details(struct appctx *appctx)
struct buffer *trash = get_trash_chunk();
struct show_ech_ctx *ctx = appctx->svcctx;
int ret = 0;
struct proxy *p;
struct bind_conf *bind_conf;
struct proxy *p = NULL;
struct bind_conf *bind_conf = NULL;
if (!ctx) return 1;
if (ctx->state == SHOW_ECH_SPECIFIC) {