summaryrefslogtreecommitdiffstats
path: root/src/libsystemd/sd-journal
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-04-30 00:00:31 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-05-01 07:24:55 +0200
commitf11de491ca305dc31378660c6883cc23d16c9ae7 (patch)
tree35f2b8d00fe3d0031e9a7ee0d0bf8d20f21baebf /src/libsystemd/sd-journal
parentsd-journal: fix use-after-free (diff)
downloadsystemd-f11de491ca305dc31378660c6883cc23d16c9ae7.tar.xz
systemd-f11de491ca305dc31378660c6883cc23d16c9ae7.zip
sd-journal: unset prioq index on failure
Otherwise, potentially, the assertion in journal_file_unlink_newest_by_bood_id() will be triggered.
Diffstat (limited to 'src/libsystemd/sd-journal')
-rw-r--r--src/libsystemd/sd-journal/sd-journal.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libsystemd/sd-journal/sd-journal.c b/src/libsystemd/sd-journal/sd-journal.c
index d5561c9a46..d4adbe5f0f 100644
--- a/src/libsystemd/sd-journal/sd-journal.c
+++ b/src/libsystemd/sd-journal/sd-journal.c
@@ -2353,8 +2353,10 @@ static int journal_file_reshuffle_newest_by_boot_id(sd_journal *j, JournalFile *
return r;
r = hashmap_ensure_put(&j->newest_by_boot_id, &id128_hash_ops, &f->newest_boot_id, q);
- if (r < 0)
+ if (r < 0) {
+ f->newest_boot_id_prioq_idx = PRIOQ_IDX_NULL;
return r;
+ }
TAKE_PTR(q);
}