Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
82d1352e
There was an error fetching the commit references. Please try again later.
Commit
82d1352e
authored
7 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Fixed File::open to avoid memory leak
parent
1b7a3c31
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TNL/File.cpp
+6
-7
6 additions, 7 deletions
src/TNL/File.cpp
with
6 additions
and
7 deletions
src/TNL/File.cpp
+
6
−
7
View file @
82d1352e
...
...
@@ -34,6 +34,9 @@ File :: ~File()
bool
File
::
open
(
const
String
&
fileName
,
const
IOMode
mode
)
{
// close the existing file to avoid memory leaks
this
->
close
();
this
->
fileName
=
fileName
;
if
(
verbose
)
{
...
...
@@ -75,17 +78,13 @@ bool File :: close()
fileName
=
""
;
readElements
=
writtenElements
=
0
;
return
true
;
}
;
}
bool
fileExists
(
const
String
&
fileName
)
{
std
::
fstream
file
;
file
.
open
(
fileName
.
getString
(),
std
::
ios
::
in
);
bool
result
(
true
);
if
(
!
file
)
result
=
false
;
file
.
close
();
return
result
;
};
return
!
file
.
fail
();
}
}
// namespace TNL
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