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

Unified Diff: bin/process_macos.cc

Issue 8555024: - Avoid allocating variable length arrays on the stack. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 9 years, 1 month 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 | « bin/process_linux.cc ('k') | vm/globals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bin/process_macos.cc
===================================================================
--- bin/process_macos.cc (revision 1537)
+++ bin/process_macos.cc (working copy)
@@ -189,7 +189,7 @@
return errno;
}
- char* program_arguments[arguments_length + 2];
+ char** program_arguments = new char*[arguments_length + 2];
program_arguments[0] = const_cast<char *>(path);
for (int i = 0; i < arguments_length; i++) {
program_arguments[i + 1] = arguments[i];
@@ -206,6 +206,7 @@
pid = fork();
if (pid < 0) {
SetChildOsErrorMessage(os_error_message, os_error_message_len);
+ delete[] program_arguments;
close(read_in[0]);
close(read_in[1]);
close(read_err[0]);
@@ -255,6 +256,9 @@
exit(1);
}
+ // The arguments for the spawned process are not needed any longer.
+ delete[] program_arguments;
+
int event_fds[2];
result = pipe(event_fds);
if (result < 0) {
« no previous file with comments | « bin/process_linux.cc ('k') | vm/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698