1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 00:51:24 +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:
Lennart Poettering 2014-10-24 18:33:29 +02:00
parent 69f0081748
commit 0b76b4d8c2
2 changed files with 4 additions and 3 deletions

View File

@ -1366,8 +1366,7 @@ int config_parse_timer(const char *unit,
v = new0(TimerValue, 1); v = new0(TimerValue, 1);
if (!v) { if (!v) {
if (c) calendar_spec_free(c);
calendar_spec_free(c);
return log_oom(); return log_oom();
} }

View File

@ -35,7 +35,9 @@ static void free_chain(CalendarComponent *c) {
} }
void calendar_spec_free(CalendarSpec *c) { void calendar_spec_free(CalendarSpec *c) {
assert(c);
if (!c)
return;
free_chain(c->year); free_chain(c->year);
free_chain(c->month); free_chain(c->month);