]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix possible memory leak
authorKarel Zak <kzak@redhat.com>
Thu, 2 May 2024 08:15:29 +0000 (10:15 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 2 May 2024 08:56:26 +0000 (10:56 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context_mount.c

index 478a9fde4e15c20a24480396113cc1f3189999be..f9d610f77840526c4c231c123144c4add6031212 100644 (file)
@@ -546,9 +546,10 @@ static int do_mount(struct libmnt_context *cxt, const char *try_type)
                cxt->syscall_status = 0;
        }
 
-       if (org_type && rc != 0)
+       if (org_type && rc != 0) {
                __mnt_fs_set_fstype_ptr(cxt->fs, org_type);
-       org_type  = NULL;
+               org_type  = NULL;
+       }
 
        if (rc == 0 && try_type && cxt->update) {
                struct libmnt_fs *fs = mnt_update_get_fs(cxt->update);