]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mountpoint-util: reduce variable scope
authorDavid Tardon <dtardon@redhat.com>
Wed, 30 Nov 2022 14:18:15 +0000 (15:18 +0100)
committerDavid Tardon <dtardon@redhat.com>
Tue, 13 Dec 2022 14:47:52 +0000 (15:47 +0100)
src/basic/mountpoint-util.c

index dc682688a7c358be4c0c0b3d18c9b6922b722341..c9253b03f2df6381e12a6d7e79b47304f36c3a90 100644 (file)
@@ -37,7 +37,6 @@ int name_to_handle_at_loop(
                 int *ret_mnt_id,
                 int flags) {
 
-        _cleanup_free_ struct file_handle *h = NULL;
         size_t n = ORIGINAL_MAX_HANDLE_SZ;
 
         assert((flags & ~(AT_SYMLINK_FOLLOW|AT_EMPTY_PATH)) == 0);
@@ -50,6 +49,7 @@ int name_to_handle_at_loop(
          * as NULL if there's no interest in either. */
 
         for (;;) {
+                _cleanup_free_ struct file_handle *h = NULL;
                 int mnt_id = -1;
 
                 h = malloc0(offsetof(struct file_handle, f_handle) + n);
@@ -91,8 +91,6 @@ int name_to_handle_at_loop(
                 n = h->handle_bytes;
                 if (offsetof(struct file_handle, f_handle) + n < n) /* check for addition overflow */
                         return -EOVERFLOW;
-
-                h = mfree(h);
         }
 }