mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-10-29 21:55:25 +03:00
calendar: make freeing a calendar spec object deal fine with NULL
In order to make object destruction easier (in particular in combination with _cleanup_) we usually make destructors deal with NULL objects as NOPs. Change the calendar spec destructor to follow the same scheme.
This commit is contained in:
parent
69f0081748
commit
0b76b4d8c2
@ -1366,8 +1366,7 @@ int config_parse_timer(const char *unit,
|
||||
|
||||
v = new0(TimerValue, 1);
|
||||
if (!v) {
|
||||
if (c)
|
||||
calendar_spec_free(c);
|
||||
calendar_spec_free(c);
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,9 @@ static void free_chain(CalendarComponent *c) {
|
||||
}
|
||||
|
||||
void calendar_spec_free(CalendarSpec *c) {
|
||||
assert(c);
|
||||
|
||||
if (!c)
|
||||
return;
|
||||
|
||||
free_chain(c->year);
|
||||
free_chain(c->month);
|
||||
|
Loading…
Reference in New Issue
Block a user