Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b4484a5 authored by Ryan Mitchell's avatar Ryan Mitchell Committed by Luca Stefani
Browse files

Fix memory leak in aapt2

Fix a memory leak in Main.cpp.

Bug: 141312058
Test: m -j aapt2 SANITIZE_TARGET=address
Change-Id: I54b61792ab75e2f59298dd38168653e496c84bff
parent 258bd827
Loading
Loading
Loading
Loading
+3 −8
Original line number Diff line number Diff line
@@ -169,17 +169,12 @@ int MainImpl(int argc, char** argv) {
  aapt::text::Printer printer(&fout);

  aapt::StdErrDiagnostics diagnostics;
  auto main_command = new aapt::MainCommand(&printer, &diagnostics);
  aapt::MainCommand main_command(&printer, &diagnostics);

  // Add the daemon subcommand here so it cannot be called while executing the daemon
  main_command->AddOptionalSubcommand(
  main_command.AddOptionalSubcommand(
      aapt::util::make_unique<aapt::DaemonCommand>(&fout, &diagnostics));
  return main_command->Execute(args, &std::cerr);
}

// TODO(b/141312058) stop leaks
extern "C" const char *__asan_default_options() {
    return "detect_leaks=0";
  return main_command.Execute(args, &std::cerr);
}

int main(int argc, char** argv) {