From 8b4ef777fd5e9d7d5de55e302ffbd0e2ac124efd Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 27 Aug 2024 11:17:56 +0900 Subject: [PATCH] conf-parser: fix memleak in config_parse_calendar() Fixes a bug introduced by 0e10c3d8724b0a5d07871c9de71565ac91dd55b7 (#25049). --- src/shared/conf-parser.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c index c4633fc52f1..978a477f6dd 100644 --- a/src/shared/conf-parser.c +++ b/src/shared/conf-parser.c @@ -2038,11 +2038,12 @@ int config_parse_calendar( } r = calendar_spec_from_string(rvalue, &c); - if (r < 0) + if (r < 0) { log_syntax(unit, LOG_WARNING, filename, line, r, "Failed to parse calendar specification, ignoring: %s", rvalue); - else - *cr = TAKE_PTR(c); + return 0; + } + free_and_replace_full(*cr, c, calendar_spec_free); return 0; } -- 2.47.3