Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Suyu
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
many-archive
Suyu
Commits
149bda98
There was an error fetching the commit references. Please try again later.
Commit
149bda98
authored
6 years ago
by
Zach Hilman
Browse files
Options
Downloads
Patches
Plain Diff
romfs: Remove cyclic shared_ptr leak in romfs code
parent
893447b6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/core/file_sys/romfs.cpp
+4
-4
4 additions, 4 deletions
src/core/file_sys/romfs.cpp
src/core/file_sys/vfs_vector.cpp
+2
-2
2 additions, 2 deletions
src/core/file_sys/vfs_vector.cpp
src/core/file_sys/vfs_vector.h
+2
-2
2 additions, 2 deletions
src/core/file_sys/vfs_vector.h
with
8 additions
and
8 deletions
src/core/file_sys/romfs.cpp
+
4
−
4
View file @
149bda98
...
@@ -65,7 +65,7 @@ void ProcessFile(VirtualFile file, size_t file_offset, size_t data_offset, u32 t
...
@@ -65,7 +65,7 @@ void ProcessFile(VirtualFile file, size_t file_offset, size_t data_offset, u32 t
auto
entry
=
GetEntry
<
FileEntry
>
(
file
,
file_offset
+
this_file_offset
);
auto
entry
=
GetEntry
<
FileEntry
>
(
file
,
file_offset
+
this_file_offset
);
parent
->
AddFile
(
std
::
make_shared
<
OffsetVfsFile
>
(
parent
->
AddFile
(
std
::
make_shared
<
OffsetVfsFile
>
(
file
,
entry
.
first
.
size
,
entry
.
first
.
offset
+
data_offset
,
entry
.
second
,
parent
));
file
,
entry
.
first
.
size
,
entry
.
first
.
offset
+
data_offset
,
entry
.
second
));
if
(
entry
.
first
.
sibling
==
ROMFS_ENTRY_EMPTY
)
if
(
entry
.
first
.
sibling
==
ROMFS_ENTRY_EMPTY
)
break
;
break
;
...
@@ -79,7 +79,7 @@ void ProcessDirectory(VirtualFile file, size_t dir_offset, size_t file_offset, s
...
@@ -79,7 +79,7 @@ void ProcessDirectory(VirtualFile file, size_t dir_offset, size_t file_offset, s
while
(
true
)
{
while
(
true
)
{
auto
entry
=
GetEntry
<
DirectoryEntry
>
(
file
,
dir_offset
+
this_dir_offset
);
auto
entry
=
GetEntry
<
DirectoryEntry
>
(
file
,
dir_offset
+
this_dir_offset
);
auto
current
=
std
::
make_shared
<
VectorVfsDirectory
>
(
auto
current
=
std
::
make_shared
<
VectorVfsDirectory
>
(
std
::
vector
<
VirtualFile
>
{},
std
::
vector
<
VirtualDir
>
{},
parent
,
entry
.
second
);
std
::
vector
<
VirtualFile
>
{},
std
::
vector
<
VirtualDir
>
{},
entry
.
second
);
if
(
entry
.
first
.
child_file
!=
ROMFS_ENTRY_EMPTY
)
{
if
(
entry
.
first
.
child_file
!=
ROMFS_ENTRY_EMPTY
)
{
ProcessFile
(
file
,
file_offset
,
data_offset
,
entry
.
first
.
child_file
,
current
);
ProcessFile
(
file
,
file_offset
,
data_offset
,
entry
.
first
.
child_file
,
current
);
...
@@ -108,9 +108,9 @@ VirtualDir ExtractRomFS(VirtualFile file) {
...
@@ -108,9 +108,9 @@ VirtualDir ExtractRomFS(VirtualFile file) {
const
u64
file_offset
=
header
.
file_meta
.
offset
;
const
u64
file_offset
=
header
.
file_meta
.
offset
;
const
u64
dir_offset
=
header
.
directory_meta
.
offset
+
4
;
const
u64
dir_offset
=
header
.
directory_meta
.
offset
+
4
;
const
auto
root
=
auto
root
=
std
::
make_shared
<
VectorVfsDirectory
>
(
std
::
vector
<
VirtualFile
>
{},
std
::
vector
<
VirtualDir
>
{},
std
::
make_shared
<
VectorVfsDirectory
>
(
std
::
vector
<
VirtualFile
>
{},
std
::
vector
<
VirtualDir
>
{},
file
->
GetContainingDirectory
()
,
file
->
GetName
()
);
file
->
GetName
(),
file
->
GetContainingDirectory
());
ProcessDirectory
(
file
,
dir_offset
,
file_offset
,
header
.
data_offset
,
0
,
root
);
ProcessDirectory
(
file
,
dir_offset
,
file_offset
,
header
.
data_offset
,
0
,
root
);
...
...
This diff is collapsed.
Click to expand it.
src/core/file_sys/vfs_vector.cpp
+
2
−
2
View file @
149bda98
...
@@ -8,8 +8,8 @@
...
@@ -8,8 +8,8 @@
namespace
FileSys
{
namespace
FileSys
{
VectorVfsDirectory
::
VectorVfsDirectory
(
std
::
vector
<
VirtualFile
>
files_
,
VectorVfsDirectory
::
VectorVfsDirectory
(
std
::
vector
<
VirtualFile
>
files_
,
std
::
vector
<
VirtualDir
>
dirs_
,
VirtualDir
parent
_
,
std
::
vector
<
VirtualDir
>
dirs_
,
std
::
string
name
_
,
std
::
string
name
_
)
VirtualDir
parent
_
)
:
files
(
std
::
move
(
files_
)),
dirs
(
std
::
move
(
dirs_
)),
parent
(
std
::
move
(
parent_
)),
:
files
(
std
::
move
(
files_
)),
dirs
(
std
::
move
(
dirs_
)),
parent
(
std
::
move
(
parent_
)),
name
(
std
::
move
(
name_
))
{}
name
(
std
::
move
(
name_
))
{}
...
...
This diff is collapsed.
Click to expand it.
src/core/file_sys/vfs_vector.h
+
2
−
2
View file @
149bda98
...
@@ -12,8 +12,8 @@ namespace FileSys {
...
@@ -12,8 +12,8 @@ namespace FileSys {
// Vector data is supplied upon construction.
// Vector data is supplied upon construction.
struct
VectorVfsDirectory
:
public
VfsDirectory
{
struct
VectorVfsDirectory
:
public
VfsDirectory
{
explicit
VectorVfsDirectory
(
std
::
vector
<
VirtualFile
>
files
=
{},
explicit
VectorVfsDirectory
(
std
::
vector
<
VirtualFile
>
files
=
{},
std
::
vector
<
VirtualDir
>
dirs
=
{},
VirtualDir
parent
=
nullptr
,
std
::
vector
<
VirtualDir
>
dirs
=
{},
std
::
string
name
=
""
,
std
::
string
name
=
""
);
VirtualDir
parent
=
nullptr
);
std
::
vector
<
std
::
shared_ptr
<
VfsFile
>>
GetFiles
()
const
override
;
std
::
vector
<
std
::
shared_ptr
<
VfsFile
>>
GetFiles
()
const
override
;
std
::
vector
<
std
::
shared_ptr
<
VfsDirectory
>>
GetSubdirectories
()
const
override
;
std
::
vector
<
std
::
shared_ptr
<
VfsDirectory
>>
GetSubdirectories
()
const
override
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment