]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
xzdec: Don't leave Landlock file descriptor open for no reason
authorLasse Collin <lasse.collin@tukaani.org>
Sat, 4 Jan 2025 18:04:56 +0000 (20:04 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Sat, 4 Jan 2025 18:09:42 +0000 (20:09 +0200)
This fix is similar to 48ff3f06521ca326996ab9a04d1b342098960427.

Fixes: d74fb5f060b76db709b50f5fd37490394e52f975
(cherry picked from commit 2655c81b5e92278b0fd51f6537c1116f8349b02a)

src/xzdec/xzdec.c

index 88866da76ffdbe032967df423b491c13ceaaa51a..d281e0711a5142416477ca4d3dbbf63b790ffa59 100644 (file)
@@ -362,6 +362,8 @@ sandbox_enter(int src_fd)
                // before activating the sandbox.
                if (syscall(SYS_landlock_restrict_self, ruleset_fd, 0U) != 0)
                        goto error;
+
+               (void)close(ruleset_fd);
        }
 
        (void)src_fd;