sd-journal: fix potential memory leak

Though, hopefully, the memory leak is hypothetical, as we always close
journal file with the timer by journal_file_offline_close().
This commit is contained in:
Yu Watanabe
2024-02-15 09:50:18 +09:00
parent da96afcd6c
commit a9c2e0f426
2 changed files with 3 additions and 1 deletions
+2
View File
@@ -281,6 +281,8 @@ JournalFile* journal_file_close(JournalFile *f) {
assert(f->newest_boot_id_prioq_idx == PRIOQ_IDX_NULL);
sd_event_source_disable_unref(f->post_change_timer);
if (f->cache_fd)
mmap_cache_fd_free(f->cache_fd);
+1 -1
View File
@@ -399,7 +399,7 @@ JournalFile* journal_file_offline_close(JournalFile *f) {
if (sd_event_source_get_enabled(f->post_change_timer, NULL) > 0)
journal_file_post_change(f);
sd_event_source_disable_unref(f->post_change_timer);
f->post_change_timer = sd_event_source_disable_unref(f->post_change_timer);
journal_file_set_offline(f, true);