journal: do not trigger assertion when journal_file_close() get NULL
We generally expect destructors to not complain if a NULL argument is passed. Closes #12400.
This commit is contained in:
@@ -340,7 +340,8 @@ bool journal_file_is_offlining(JournalFile *f) {
|
||||
}
|
||||
|
||||
JournalFile* journal_file_close(JournalFile *f) {
|
||||
assert(f);
|
||||
if (!f)
|
||||
return NULL;
|
||||
|
||||
#if HAVE_GCRYPT
|
||||
/* Write the final tag */
|
||||
|
||||
@@ -2232,11 +2232,8 @@ void server_done(Server *s) {
|
||||
|
||||
client_context_flush_all(s);
|
||||
|
||||
if (s->system_journal)
|
||||
(void) journal_file_close(s->system_journal);
|
||||
|
||||
if (s->runtime_journal)
|
||||
(void) journal_file_close(s->runtime_journal);
|
||||
(void) journal_file_close(s->system_journal);
|
||||
(void) journal_file_close(s->runtime_journal);
|
||||
|
||||
ordered_hashmap_free_with_destructor(s->user_journals, journal_file_close);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user