84 lines
2.8 KiB
Diff
84 lines
2.8 KiB
Diff
|
|
From 4b269f8131591e3067b54dc1f587592bfca10fba Mon Sep 17 00:00:00 2001
|
||
|
|
From: Quentin Armitage <quentin@armitage.org.uk>
|
||
|
|
Date: Tue, 26 Jul 2022 09:42:01 +0100
|
||
|
|
Subject: [PATCH] check: fix further memory leaks when configuration is
|
||
|
|
repeated
|
||
|
|
|
||
|
|
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
|
||
|
|
Conflict: adapt path_handler because the pre patch 516032ec39169d05c613de0e8ee10845658748ff reconstructs the configuration resolution
|
||
|
|
Reference: https://github.com/acassen/keepalived/commit/4b269f8131591e3067b54dc1f587592bfca10fba
|
||
|
|
|
||
|
|
---
|
||
|
|
keepalived/check/check_http.c | 9 +++++++--
|
||
|
|
keepalived/check/check_parser.c | 6 +-----
|
||
|
|
keepalived/check/check_smtp.c | 4 +++-
|
||
|
|
3 files changed, 11 insertions(+), 8 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/keepalived/check/check_http.c b/keepalived/check/check_http.c
|
||
|
|
index 4b1f3f3..47a9ac1 100644
|
||
|
|
--- a/keepalived/check/check_http.c
|
||
|
|
+++ b/keepalived/check/check_http.c
|
||
|
|
@@ -505,7 +505,7 @@ path_handler(const vector_t *strvec)
|
||
|
|
http_checker_t *http_get_chk = CHECKER_GET();
|
||
|
|
url_t *url = list_last_entry(&http_get_chk->url, url_t, e_list);
|
||
|
|
|
||
|
|
- url->path = set_value(strvec);
|
||
|
|
+ set_string(&url->path, strvec, "path");
|
||
|
|
}
|
||
|
|
|
||
|
|
static void
|
||
|
|
@@ -625,11 +625,16 @@ regex_handler(__attribute__((unused)) const vector_t *strvec)
|
||
|
|
const vector_t *strvec_qe = alloc_strvec_quoted_escaped(NULL);
|
||
|
|
|
||
|
|
if (vector_size(strvec_qe) != 2) {
|
||
|
|
- log_message(LOG_INFO, "regex missing or too many fields");
|
||
|
|
+ report_config_error(CONFIG_GENERAL_ERROR, "regex missing or too many fields");
|
||
|
|
free_strvec(strvec_qe);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
+ if (conf_regex_pattern) {
|
||
|
|
+ report_config_error(CONFIG_GENERAL_ERROR, "Duplicate regex specified - replacing %s with %s", conf_regex_pattern, strvec_slot(strvec, 1));
|
||
|
|
+ FREE_CONST_PTR(conf_regex_pattern);
|
||
|
|
+ }
|
||
|
|
+
|
||
|
|
conf_regex_pattern = PTR_CAST_CONST(unsigned char, set_value(strvec_qe));
|
||
|
|
free_strvec(strvec_qe);
|
||
|
|
}
|
||
|
|
diff --git a/keepalived/check/check_parser.c b/keepalived/check/check_parser.c
|
||
|
|
index ec8f779..f24215e 100644
|
||
|
|
--- a/keepalived/check/check_parser.c
|
||
|
|
+++ b/keepalived/check/check_parser.c
|
||
|
|
@@ -74,11 +74,7 @@ handle_ssl_file(const vector_t *strvec, const char **file_name, const char *type
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
- if (*file_name) {
|
||
|
|
- report_config_error(CONFIG_GENERAL_ERROR, "SSL %s already specified - replacing", type);
|
||
|
|
- FREE_CONST(*file_name);
|
||
|
|
- }
|
||
|
|
- *file_name = set_value(strvec);
|
||
|
|
+ set_string(file_name, strvec, "SSL");
|
||
|
|
}
|
||
|
|
|
||
|
|
static void
|
||
|
|
diff --git a/keepalived/check/check_smtp.c b/keepalived/check/check_smtp.c
|
||
|
|
index 034d891..65db135 100644
|
||
|
|
--- a/keepalived/check/check_smtp.c
|
||
|
|
+++ b/keepalived/check/check_smtp.c
|
||
|
|
@@ -273,8 +273,10 @@ smtp_helo_name_handler(const vector_t *strvec)
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
- if (smtp_checker->helo_name)
|
||
|
|
+ if (smtp_checker->helo_name) {
|
||
|
|
+ report_config_error(CONFIG_GENERAL_ERROR, "SMTP_CHECK helo name already specified");
|
||
|
|
FREE_CONST(smtp_checker->helo_name);
|
||
|
|
+ }
|
||
|
|
|
||
|
|
smtp_checker->helo_name = set_value(strvec);
|
||
|
|
}
|
||
|
|
--
|
||
|
|
2.33.0
|
||
|
|
|