BUG/MINOR: server: fix potential null gcc error in delete server

gcc still reports a potential null pointer dereference in delete server
function event with a BUG_ON before it. Remove the misleading NULL check
in the for loop which should never happen.

This does not need to be backported.
This commit is contained in:
Amaury Denoyelle 2021-04-21 11:50:26 +02:00
parent b77cd7f562
commit d6b4b6da3f

View File

@ -4563,12 +4563,12 @@ static int cli_parse_delete_server(char **args, char *payload, struct appctx *ap
}
else {
struct server *next;
for (next = be->srv; next && srv != next->next; next = next->next)
;
for (next = be->srv; srv != next->next; next = next->next) {
/* srv cannot be not found since we have already found
* it with get_backend_server */
BUG_ON(!next);
}
/* srv cannot be not found since we have already found it
* with get_backend_server */
BUG_ON(!next);
next->next = srv->next;
}