chiark / gitweb /
Never call qsort on potentially NULL arrays
[elogind.git] / src / journal / journalctl.c
index 2f8be1b83e9d37b7382551571760583c4d0f50c8..275458c4821aabd30516f785a2f7dc37148c4b97 100644 (file)
@@ -761,7 +761,7 @@ static int get_relative_boot_id(sd_journal *j, sd_id128_t *boot_id, int relative
                 sd_journal_flush_matches(j);
         }
 
-        qsort(all_ids, count, sizeof(boot_id_t), boot_id_cmp);
+        qsort_safe(all_ids, count, sizeof(boot_id_t), boot_id_cmp);
 
         if (sd_id128_equal(*boot_id, SD_ID128_NULL)) {
                 if (relative > (int) count || relative <= -(int)count)