From 6d5202ccaa9e61740bb9d1983365cd65962ac6ab Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 2 Nov 2023 09:34:18 +0000 Subject: [PATCH] mount-util: call CLEANUP_ARRAY after allocating array Coverity gets confused if it is called before. CID#1523757 --- src/shared/mount-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index a7493a3814..02640a13a9 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -1378,12 +1378,12 @@ int remount_idmap_fd( int *mount_fds = NULL; size_t n_mounts_fds = 0; - CLEANUP_ARRAY(mount_fds, n_mounts_fds, close_many_and_free); - mount_fds = new(int, n); if (!mount_fds) return log_oom_debug(); + CLEANUP_ARRAY(mount_fds, n_mounts_fds, close_many_and_free); + for (size_t i = 0; i < n; i++) { int mntfd;