summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-08-27 04:17:56 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-09-01 22:41:55 +0200
commit8b4ef777fd5e9d7d5de55e302ffbd0e2ac124efd (patch)
tree6e5940c724bd908f75925d10dfd4ebb120223b64 /src
parentnetwork/route: fix typo (diff)
downloadsystemd-8b4ef777fd5e9d7d5de55e302ffbd0e2ac124efd.tar.xz
systemd-8b4ef777fd5e9d7d5de55e302ffbd0e2ac124efd.zip
conf-parser: fix memleak in config_parse_calendar()
Fixes a bug introduced by 0e10c3d8724b0a5d07871c9de71565ac91dd55b7 (#25049).
Diffstat (limited to '')
-rw-r--r--src/shared/conf-parser.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index c4633fc52f..978a477f6d 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;
}