Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Unified Diff: runtime/bin/file_linux.cc

Issue 1892623002: Fixes leak of native File objects. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file_android.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_linux.cc
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index 0cd9dec4469633f1a0d8ffda3524e3b633258b27..2bf2c2edaa9847089d3deb45758c0522e41fe3a1 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -38,7 +38,9 @@ class FileHandle {
File::~File() {
- Close();
+ if (!IsClosed()) {
+ Close();
+ }
delete handle_;
}
@@ -196,10 +198,7 @@ File* File::Open(const char* path, FileOpenMode mode) {
File* File::OpenStdio(int fd) {
- if ((fd < 0) || (2 < fd)) {
- return NULL;
- }
- return new File(new FileHandle(fd));
+ return ((fd < 0) || (2 < fd)) ? NULL : new File(new FileHandle(fd));
}
« no previous file with comments | « runtime/bin/file_android.cc ('k') | runtime/bin/file_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698