diff options
author | Doug Christman <douglaschristman@gmail.com> | 2016-12-14 13:21:27 -0500 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-12-14 19:21:27 +0100 |
commit | fc2371c7b1b41c2e3c8123317933322173f8abae (patch) | |
tree | f4f64c96747793be2f4924487b441f4cced0ef08 | |
parent | f6f372d2f46ac9be7cbb1ecd8f82f1b3ab669924 (diff) |
calendarspec: free memory when parsing fails (#4890)
This prevents memory leaks on strings like `*~*-*`.
Fixes #4887
-rw-r--r-- | src/basic/calendarspec.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/basic/calendarspec.c b/src/basic/calendarspec.c index 514587d237..adf79eb533 100644 --- a/src/basic/calendarspec.c +++ b/src/basic/calendarspec.c @@ -688,8 +688,11 @@ static int parse_date(const char **p, CalendarSpec *c) { c->month = first; c->day = second; return 0; - } else if (c->end_of_month) + } else if (c->end_of_month) { + free_chain(first); + free_chain(second); return -EINVAL; + } if (*t == '~') c->end_of_month = true; |