calendarspec: free memory when parsing fails (#4890)
This prevents memory leaks on strings like `*~*-*`. Fixes #4887
This commit is contained in:
committed by
Lennart Poettering
parent
f6f372d2f4
commit
fc2371c7b1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user