Object **ret_object,
uint64_t *ret_offset) {
+ _cleanup_free_ EntryItem *items_alloc = NULL;
EntryItem *items;
- int r;
uint64_t xor_hash = 0;
struct dual_timestamp _ts;
+ int r;
assert(f);
assert(f->header);
return r;
#endif
- items = newa(EntryItem, n_iovec);
+ if (n_iovec < ALLOCA_MAX / sizeof(EntryItem) / 2)
+ items = newa(EntryItem, n_iovec);
+ else {
+ items_alloc = new(EntryItem, n_iovec);
+ if (!items_alloc)
+ return -ENOMEM;
+
+ items = items_alloc;
+ }
for (size_t i = 0; i < n_iovec; i++) {
uint64_t p;
}
int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint64_t p) {
+ _cleanup_free_ EntryItem *items_alloc = NULL;
+ EntryItem *items;
uint64_t q, n, xor_hash = 0;
const sd_id128_t *boot_id;
dual_timestamp ts;
- EntryItem *items;
int r;
assert(from);
boot_id = &o->entry.boot_id;
n = journal_file_entry_n_items(from, o);
- items = newa(EntryItem, n);
+
+ if (n < ALLOCA_MAX / sizeof(EntryItem) / 2)
+ items = newa(EntryItem, n);
+ else {
+ items_alloc = new(EntryItem, n);
+ if (!items_alloc)
+ return -ENOMEM;
+
+ items = items_alloc;
+ }
for (uint64_t i = 0; i < n; i++) {
uint64_t h;