From: Yu Watanabe Date: Wed, 26 Apr 2023 11:54:08 +0000 (+0900) Subject: sd-journal: make journal_file_copy_entry() return earlier X-Git-Tag: v254-rc1~623^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F27419%2Fhead;p=thirdparty%2Fsystemd.git sd-journal: make journal_file_copy_entry() return earlier --- diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index e9bb893ca82..f6a86fe5999 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -4188,6 +4188,8 @@ int journal_file_copy_entry( boot_id = o->entry.boot_id; n = journal_file_entry_n_items(from, o); + if (n == 0) + return 0; if (n < ALLOCA_MAX / sizeof(EntryItem) / 2) items = newa(EntryItem, n);