]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
logs-show: use GREEDY_REALLOC_APPEND()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 26 Apr 2024 02:31:48 +0000 (11:31 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 May 2024 02:43:57 +0000 (11:43 +0900)
src/shared/logs-show.c

index 9851fd3646f665e34e83882eddde6d5542a9ff0f..c96f501f0ef8c8a3778133b8c8043d976254fae3 100644 (file)
@@ -2024,10 +2024,8 @@ int journal_get_boots(sd_journal *j, BootId **ret_boots, size_t *ret_n_boots) {
                                  * Exiting as otherwise this problem would cause an infinite loop. */
                                 goto finish;
 
-                if (!GREEDY_REALLOC(boots, n_boots + 1))
+                if (!GREEDY_REALLOC_APPEND(boots, n_boots, &boot, 1))
                         return -ENOMEM;
-
-                boots[n_boots++] = boot;
         }
 
  finish: