calendarspec: free memory when parsing fails (#4890)

This prevents memory leaks on strings like `*~*-*`.

Fixes #4887
This commit is contained in:
Doug Christman
2016-12-14 19:21:27 +01:00
committed by Lennart Poettering
parent f6f372d2f4
commit fc2371c7b1
+4 -1
View File
@@ -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;