| Index: runtime/bin/process_linux.cc
|
| diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc
|
| index 30f188f1299209ae7bac3ca51af82ae68bdcb028..572ced76e1b25188d4e86d1d6c4caf57b2c76d7f 100644
|
| --- a/runtime/bin/process_linux.cc
|
| +++ b/runtime/bin/process_linux.cc
|
| @@ -16,6 +16,7 @@
|
| #include <sys/wait.h> // NOLINT
|
| #include <unistd.h> // NOLINT
|
|
|
| +#include "bin/dartutils.h"
|
| #include "bin/fdutils.h"
|
| #include "bin/lockers.h"
|
| #include "bin/log.h"
|
| @@ -634,7 +635,9 @@ class ProcessStarter {
|
| int actual_errno = errno;
|
| // If CleanupAndReturnError is called without an actual errno make
|
| // sure to return an error anyway.
|
| - if (actual_errno == 0) actual_errno = EPERM;
|
| + if (actual_errno == 0) {
|
| + actual_errno = EPERM;
|
| + }
|
| SetChildOsErrorMessage();
|
| CloseAllPipes();
|
| return actual_errno;
|
| @@ -643,8 +646,9 @@ class ProcessStarter {
|
|
|
| void SetChildOsErrorMessage() {
|
| const int kBufferSize = 1024;
|
| - char error_buf[kBufferSize];
|
| - *os_error_message_ = strdup(Utils::StrError(errno, error_buf, kBufferSize));
|
| + char* error_message = DartUtils::ScopedCString(kBufferSize);
|
| + Utils::StrError(errno, error_message, kBufferSize);
|
| + *os_error_message_ = error_message;
|
| }
|
|
|
|
|
| @@ -679,7 +683,7 @@ class ProcessStarter {
|
|
|
| void ReadChildError() {
|
| const int kMaxMessageSize = 256;
|
| - char* message = static_cast<char*>(malloc(kMaxMessageSize));
|
| + char* message = DartUtils::ScopedCString(kMaxMessageSize);
|
| if (message != NULL) {
|
| FDUtils::ReadFromBlocking(exec_control_[0], message, kMaxMessageSize);
|
| message[kMaxMessageSize - 1] = '\0';
|
|
|