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

Unified Diff: runtime/bin/platform_android.cc

Issue 1781883002: Fixes some memory leaks in //runtime/bin (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix tests on Windows Created 4 years, 9 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/platform.cc ('k') | runtime/bin/platform_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/platform_android.cc
diff --git a/runtime/bin/platform_android.cc b/runtime/bin/platform_android.cc
index 3c44c04405a57634b17babfc1b4e328d27bc8377..de60960488540c9c1f973380cc9eccc64e0d9e03 100644
--- a/runtime/bin/platform_android.cc
+++ b/runtime/bin/platform_android.cc
@@ -14,7 +14,6 @@
#include "bin/fdutils.h"
-
namespace dart {
namespace bin {
@@ -58,9 +57,12 @@ char** Platform::Environment(intptr_t* count) {
// provide access to modifying environment variables.
intptr_t i = 0;
char** tmp = environ;
- while (*(tmp++) != NULL) i++;
+ while (*(tmp++) != NULL) {
+ i++;
+ }
*count = i;
- char** result = new char*[i];
+ char** result;
+ result = reinterpret_cast<char**>(Dart_ScopeAllocate(i * sizeof(*result)));
for (intptr_t current = 0; current < i; current++) {
result[current] = environ[current];
}
@@ -68,15 +70,11 @@ char** Platform::Environment(intptr_t* count) {
}
-void Platform::FreeEnvironment(char** env, intptr_t count) {
- delete[] env;
-}
-
-
-char* Platform::ResolveExecutablePath() {
+const char* Platform::ResolveExecutablePath() {
return File::LinkTarget("/proc/self/exe");
}
+
void Platform::Exit(int exit_code) {
exit(exit_code);
}
« no previous file with comments | « runtime/bin/platform.cc ('k') | runtime/bin/platform_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698