File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/libappimage/core/impl Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 88 extern " C" {
99#include < squashfuse.h>
1010#include < squashfs_fs.h>
11+ #include < squashfuse/util.h>
1112}
1213
1314// system
@@ -52,15 +53,25 @@ class TraversalType2::Priv {
5253 rootInodeId = sqfs_inode_root (&fs);
5354 err = sqfs_traverse_open (&trv, &fs, rootInodeId);
5455 if (err != SQFS_OK) {
56+ // Save the file descriptor before destroying the fs structure
57+ sqfs_fd_t fd = fs.fd ;
5558 sqfs_destroy (&fs);
59+ // Close the file descriptor to prevent fd leak
60+ sqfs_fd_close (fd);
5661 throw IOError (" sqfs_traverse_open error" );
5762 }
5863 }
5964
6065 virtual ~Priv () {
6166 sqfs_traverse_close (&trv);
6267
68+ // Save the file descriptor before destroying the fs structure
69+ sqfs_fd_t fd = fs.fd ;
70+
6371 sqfs_destroy (&fs);
72+
73+ // Close the file descriptor to prevent fd leak
74+ sqfs_fd_close (fd);
6475 }
6576
6677 bool isCompleted () const {
You can’t perform that action at this time.
0 commit comments