chiark / gitweb /
core: priorize notification fd processing over notification fd process via sd-event...
[elogind.git] / src / journal / journal-file.c
index 4009b29b4603fbb92888d25fe84f82dffe543a68..b7e5cf0ab5bff9576aa74b2e155874f62e80612b 100644 (file)
@@ -1010,7 +1010,10 @@ static int journal_file_append_data(
         if (r < 0)
                 return r;
 
-        eq = memchr(data, '=', size);
+        if (!data)
+                eq = NULL;
+        else
+                eq = memchr(data, '=', size);
         if (eq && eq > data) {
                 uint64_t fp;
                 Object *fo;
@@ -1625,8 +1628,6 @@ static int generic_array_bisect(
                                         else
                                                 left = y + 1;
                                 }
-
-                                last_index = (uint64_t) -1;
                         }
 
                         for (;;) {
@@ -2730,7 +2731,8 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
         ts.realtime = le64toh(o->entry.realtime);
 
         n = journal_file_entry_n_items(o);
-        items = alloca(sizeof(EntryItem) * n);
+        /* alloca() can't take 0, hence let's allocate at least one */
+        items = alloca(sizeof(EntryItem) * MAX(1u, n));
 
         for (i = 0; i < n; i++) {
                 uint64_t l, h;