chiark / gitweb /
Never call qsort on potentially NULL arrays
[elogind.git] / src / journal / journal-vacuum.c
index 8d5effb45ce63d83046f9917632752b8351f42b9..d4a1c6c9334ff736bbe3066e7d0b317c71119b7b 100644 (file)
@@ -299,8 +299,7 @@ int journal_directory_vacuum(
                 n_list ++;
         }
 
                 n_list ++;
         }
 
-        if (n_list > 0)
-                qsort(list, n_list, sizeof(struct vacuum_info), vacuum_compare);
+        qsort_safe(list, n_list, sizeof(struct vacuum_info), vacuum_compare);
 
         for (i = 0; i < n_list; i++) {
                 struct statvfs ss;
 
         for (i = 0; i < n_list; i++) {
                 struct statvfs ss;