From c7edc9880a7c23d9699e92d9fe89ff1a66df2065 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 14 Apr 2022 19:49:50 +0200 Subject: [PATCH] CLEANUP: extcheck: do not needlessly preset the server's address/port During the config parsing we preset the server's address and port, but that's pointless since it's replaced during each check in order to deal with the possibility that the address was changed since. --- src/extcheck.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/extcheck.c b/src/extcheck.c index f517362ee7..d82c686d5e 100644 --- a/src/extcheck.c +++ b/src/extcheck.c @@ -311,21 +311,9 @@ int prepare_external_check(struct check *check) goto err; } - if (!check->argv[1] || !check->argv[2]) { - ha_alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id); - goto err; - } - + /* args 3 and 4 are the address, they're replaced on each check */ check->argv[3] = calloc(EXTCHK_SIZE_ADDR, sizeof(*check->argv[3])); check->argv[4] = calloc(EXTCHK_SIZE_UINT, sizeof(*check->argv[4])); - if (!check->argv[3] || !check->argv[4]) { - ha_alert("Starting [%s:%s] check: out of memory.\n", px->id, s->id); - goto err; - } - - addr_to_str(&s->addr, check->argv[3], EXTCHK_SIZE_ADDR); - if (s->addr.ss_family == AF_INET || s->addr.ss_family == AF_INET6) - snprintf(check->argv[4], EXTCHK_SIZE_UINT, "%u", s->svc_port); for (i = 0; i < 5; i++) { if (!check->argv[i]) {