[gardening] Fix embedder_samples_test leaks, uninitialized variables.

Fixes https://github.com/dart-lang/sdk/issues/59810
TEST=ci

Change-Id: I8dca122538195c8aad98e0d0fb64c7ea8e0d2e1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/402421
Reviewed-by: Brian Quinlan <bquinlan@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
This commit is contained in:
Alexander Aprelev
2024-12-26 12:28:38 -08:00
committed by Commit Queue
parent a3ef4553a5
commit 3b7716ab00
+4 -1
View File
@@ -73,7 +73,9 @@ std::string ReadSnapshot(std::string_view path) {
char* bytes = static_cast<char*>(std::malloc(length));
source_file.read(bytes, length);
return std::string(bytes, length);
auto result = std::string(bytes, length);
std::free(bytes);
return result;
}
Dart_Handle ToDartStringList(const std::vector<std::string>& values) {
@@ -122,6 +124,7 @@ int main(int argc, char** argv) {
// Start an isolate from a platform kernel.
Dart_IsolateFlags isolate_flags;
Dart_IsolateFlagsInitialize(&isolate_flags);
Dart_CreateIsolateGroupFromKernel(
/*script_uri=*/snapshot_uri.c_str(),