From: Luca Boccassi Date: Thu, 2 Nov 2023 09:34:18 +0000 (+0000) Subject: mount-util: call CLEANUP_ARRAY after allocating array X-Git-Tag: v255-rc1~44 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6d5202ccaa9e61740bb9d1983365cd65962ac6ab;p=thirdparty%2Fsystemd.git mount-util: call CLEANUP_ARRAY after allocating array Coverity gets confused if it is called before. CID#1523757 --- diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index a7493a38147..02640a13a9e 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;