chiark / gitweb /
journald: before closing /dev/kmsg let's unregister the event source
[elogind.git] / src / journal / journal-file.c
index 4009b29b4603fbb92888d25fe84f82dffe543a68..9e89cb96992250c748d5dd3f990e2213d8d1ac09 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;
@@ -2730,7 +2733,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;