]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: unset prioq index on failure
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 29 Apr 2023 22:00:31 +0000 (07:00 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 1 May 2023 05:24:55 +0000 (14:24 +0900)
Otherwise, potentially, the assertion in
journal_file_unlink_newest_by_bood_id() will be triggered.

src/libsystemd/sd-journal/sd-journal.c

index d5561c9a46b82de05d5a9aced6c4bf7992109a78..d4adbe5f0f467ff683f15d5e07b7e2719248897f 100644 (file)
@@ -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);
         }