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
19b2e739
There was an error fetching the commit references. Please try again later.
Commit
19b2e739
authored
10 years ago
by
Yuri Kunde Schlesner
Browse files
Options
Downloads
Patches
Plain Diff
FileSys: Fix a few memory leaks
parent
edbb47d9
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/file_sys/disk_archive.cpp
+6
-5
6 additions, 5 deletions
src/core/file_sys/disk_archive.cpp
src/core/file_sys/disk_archive.h
+1
-1
1 addition, 1 deletion
src/core/file_sys/disk_archive.h
with
7 additions
and
6 deletions
src/core/file_sys/disk_archive.cpp
+
6
−
5
View file @
19b2e739
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#include
"common/common_types.h"
#include
"common/common_types.h"
#include
"common/file_util.h"
#include
"common/file_util.h"
#include
"common/make_unique.h"
#include
"core/file_sys/disk_archive.h"
#include
"core/file_sys/disk_archive.h"
#include
"core/settings.h"
#include
"core/settings.h"
...
@@ -17,10 +18,10 @@ namespace FileSys {
...
@@ -17,10 +18,10 @@ namespace FileSys {
std
::
unique_ptr
<
FileBackend
>
DiskArchive
::
OpenFile
(
const
Path
&
path
,
const
Mode
mode
)
const
{
std
::
unique_ptr
<
FileBackend
>
DiskArchive
::
OpenFile
(
const
Path
&
path
,
const
Mode
mode
)
const
{
LOG_DEBUG
(
Service_FS
,
"called path=%s mode=%01X"
,
path
.
DebugStr
().
c_str
(),
mode
.
hex
);
LOG_DEBUG
(
Service_FS
,
"called path=%s mode=%01X"
,
path
.
DebugStr
().
c_str
(),
mode
.
hex
);
DiskFile
*
file
=
new
DiskFile
(
this
,
path
,
mode
);
auto
file
=
Common
::
make_unique
<
DiskFile
>
(
this
,
path
,
mode
);
if
(
!
file
->
Open
())
if
(
!
file
->
Open
())
return
nullptr
;
return
nullptr
;
return
std
::
unique_ptr
<
FileBackend
>
(
file
);
return
std
::
move
(
file
);
}
}
bool
DiskArchive
::
DeleteFile
(
const
Path
&
path
)
const
{
bool
DiskArchive
::
DeleteFile
(
const
Path
&
path
)
const
{
...
@@ -66,10 +67,10 @@ bool DiskArchive::RenameDirectory(const Path& src_path, const Path& dest_path) c
...
@@ -66,10 +67,10 @@ bool DiskArchive::RenameDirectory(const Path& src_path, const Path& dest_path) c
std
::
unique_ptr
<
DirectoryBackend
>
DiskArchive
::
OpenDirectory
(
const
Path
&
path
)
const
{
std
::
unique_ptr
<
DirectoryBackend
>
DiskArchive
::
OpenDirectory
(
const
Path
&
path
)
const
{
LOG_DEBUG
(
Service_FS
,
"called path=%s"
,
path
.
DebugStr
().
c_str
());
LOG_DEBUG
(
Service_FS
,
"called path=%s"
,
path
.
DebugStr
().
c_str
());
DiskDirectory
*
directory
=
new
DiskDirectory
(
this
,
path
);
auto
directory
=
Common
::
make_unique
<
DiskDirectory
>
(
this
,
path
);
if
(
!
directory
->
Open
())
if
(
!
directory
->
Open
())
return
nullptr
;
return
nullptr
;
return
std
::
unique_ptr
<
DirectoryBackend
>
(
directory
);
return
std
::
move
(
directory
);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////
...
@@ -100,7 +101,7 @@ bool DiskFile::Open() {
...
@@ -100,7 +101,7 @@ bool DiskFile::Open() {
// Open the file in binary mode, to avoid problems with CR/LF on Windows systems
// Open the file in binary mode, to avoid problems with CR/LF on Windows systems
mode_string
+=
"b"
;
mode_string
+=
"b"
;
file
=
new
FileUtil
::
IOFile
(
path
,
mode_string
.
c_str
());
file
=
Common
::
make_unique
<
FileUtil
::
IOFile
>
(
path
,
mode_string
.
c_str
());
return
true
;
return
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/core/file_sys/disk_archive.h
+
1
−
1
View file @
19b2e739
...
@@ -75,7 +75,7 @@ protected:
...
@@ -75,7 +75,7 @@ protected:
const
DiskArchive
*
archive
;
const
DiskArchive
*
archive
;
std
::
string
path
;
std
::
string
path
;
Mode
mode
;
Mode
mode
;
FileUtil
::
IOFile
*
file
;
std
::
unique_ptr
<
FileUtil
::
IOFile
>
file
;
};
};
class
DiskDirectory
:
public
DirectoryBackend
{
class
DiskDirectory
:
public
DirectoryBackend
{
...
...
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