[gardening] Fix memory leak in isolate test, flagged by asan

TEST=ci, asan
Change-Id: I8ed9d50f10eeb483deefb89ec84d6c71591833ac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/234602
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
This commit is contained in:
Aske Simon Christensen 2022-02-28 15:05:59 +00:00 committed by Commit Bot
parent 1be8de3ea4
commit fbfea6e022

View file

@ -23,7 +23,7 @@ VM_UNIT_TEST_CASE(IsolateCurrent) {
// Test to ensure that an exception is thrown if no isolate creation
// callback has been set by the embedder when an isolate is spawned.
void IsolateSpawn(const char* platform_script_value) {
const char* kScriptChars = OS::SCreate(
char* scriptChars = OS::SCreate(
nullptr,
"import 'dart:isolate';\n"
// Ignores printed lines.
@ -40,7 +40,9 @@ void IsolateSpawn(const char* platform_script_value) {
"}\n",
platform_script_value);
Dart_Handle test_lib = TestCase::LoadTestScript(kScriptChars, NULL);
Dart_Handle test_lib = TestCase::LoadTestScript(scriptChars, NULL);
free(scriptChars);
// Setup the internal library's 'internalPrint' function.
// Necessary because asynchronous errors use "print" to print their