Fix memory leak in IsolateMain.cpp

Bug: N/A
Test: Presubmits
Change-Id: I6770b5888176c8b66578ad33993bf9e5be866a60
diff --git a/IsolateMain.cpp b/IsolateMain.cpp
index 853d7e4..0d214f9 100644
--- a/IsolateMain.cpp
+++ b/IsolateMain.cpp
@@ -174,20 +174,20 @@
 
   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);
   }