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

Side by Side Diff: runtime/bin/main.cc

Issue 1892623002: Fixes leak of native File objects. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Remove unused GetFD 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "include/dart_tools_api.h" 10 #include "include/dart_tools_api.h"
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 if (write_magic_number) { 1098 if (write_magic_number) {
1099 // Write the magic number to indicate file is a script snapshot. 1099 // Write the magic number to indicate file is a script snapshot.
1100 DartUtils::WriteMagicNumber(file); 1100 DartUtils::WriteMagicNumber(file);
1101 } 1101 }
1102 1102
1103 if (!file->WriteFully(buffer, size)) { 1103 if (!file->WriteFully(buffer, size)) {
1104 ErrorExit(kErrorExitCode, 1104 ErrorExit(kErrorExitCode,
1105 "Unable to open file %s for writing snapshot\n", 1105 "Unable to open file %s for writing snapshot\n",
1106 qualified_filename); 1106 qualified_filename);
1107 } 1107 }
1108 delete file; 1108 file->Release();
1109 if (concat != NULL) { 1109 if (concat != NULL) {
1110 delete concat; 1110 delete concat;
1111 } 1111 }
1112 } 1112 }
1113 1113
1114 1114
1115 static void ReadSnapshotFile(const char* snapshot_directory, 1115 static void ReadSnapshotFile(const char* snapshot_directory,
1116 const char* filename, 1116 const char* filename,
1117 const uint8_t** buffer) { 1117 const uint8_t** buffer) {
1118 char* concat = NULL; 1118 char* concat = NULL;
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1705 Platform::Exit(Process::GlobalExitCode()); 1705 Platform::Exit(Process::GlobalExitCode());
1706 } 1706 }
1707 1707
1708 } // namespace bin 1708 } // namespace bin
1709 } // namespace dart 1709 } // namespace dart
1710 1710
1711 int main(int argc, char** argv) { 1711 int main(int argc, char** argv) {
1712 dart::bin::main(argc, argv); 1712 dart::bin::main(argc, argv);
1713 UNREACHABLE(); 1713 UNREACHABLE();
1714 } 1714 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698