summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sedam <matthewsedam@google.com>2024-04-22 20:45:33 +0000
committerMatthew Sedam <matthewsedam@google.com>2024-04-22 20:45:33 +0000
commit4ab89ae5f1cc3d2af34fac4598d65a66cfd3a06a (patch)
tree671d16b31f592b07097559395d06aa113ca104ea
parent46269d1a9c6d5dd827d1e4f4789d7228d59adb1f (diff)
downloadgtest_extras-master.tar.gz
Fix memory leak in IsolateMain.cppHEADmastermain
Bug: N/A Test: Presubmits Change-Id: I6770b5888176c8b66578ad33993bf9e5be866a60
-rw-r--r--IsolateMain.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/IsolateMain.cpp b/IsolateMain.cpp
index 853d7e4..0d214f9 100644
--- a/IsolateMain.cpp
+++ b/IsolateMain.cpp
@@ -174,20 +174,20 @@ int IsolateMain(int argc, char** argv, char**) {
std::vector<char*> child_args;
android::gtest_extras::Options options;
- if (!options.Process(args, &child_args)) {
- return 1;
+ int return_val = 1;
+ if (options.Process(args, &child_args)) {
+ // Add the --no_isolate option to force child processes not to rerun
+ // in isolation mode.
+ child_args.push_back(strdup("--no_isolate"));
+
+ // Set the flag values.
+ ::testing::GTEST_FLAG(color) = options.color();
+ ::testing::GTEST_FLAG(print_time) = options.print_time();
+
+ android::gtest_extras::Isolate isolate(options, child_args);
+ return_val = isolate.Run();
}
- // Add the --no_isolate option to force child processes not to rerun
- // in isolation mode.
- child_args.push_back(strdup("--no_isolate"));
-
- // Set the flag values.
- ::testing::GTEST_FLAG(color) = options.color();
- ::testing::GTEST_FLAG(print_time) = options.print_time();
-
- android::gtest_extras::Isolate isolate(options, child_args);
- int return_val = isolate.Run();
for (auto child_arg : child_args) {
free(child_arg);
}