[ VM ] Fix invalid free introduced in c42c76f590
It's possible for loading the CLI isolate from snapshot to be skipped without failing for SIMARM, so *error would not point to a valid error, causing free(*error) to crash. TEST=Existing tests Change-Id: Ic178f7bd0f89c4440b2daf714fbb2e428867bd72 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178723 Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
+8
-3
@@ -592,7 +592,10 @@ static Dart_Isolate CreateAndSetupDartDevIsolate(const char* script_uri,
|
||||
IsolateGroupData* isolate_group_data = nullptr;
|
||||
IsolateData* isolate_data = nullptr;
|
||||
|
||||
AppSnapshot* app_snapshot;
|
||||
if (error != nullptr) {
|
||||
*error = nullptr;
|
||||
}
|
||||
AppSnapshot* app_snapshot = nullptr;
|
||||
bool isolate_run_app_snapshot = true;
|
||||
if (dartdev_path.get() != nullptr &&
|
||||
(app_snapshot = Snapshot::TryReadAppSnapshot(dartdev_path.get())) !=
|
||||
@@ -618,8 +621,10 @@ static Dart_Isolate CreateAndSetupDartDevIsolate(const char* script_uri,
|
||||
isolate_run_app_snapshot = false;
|
||||
dartdev_path = DartDevIsolate::TryResolveDartDevKernelPath();
|
||||
// Clear error from app snapshot and retry from kernel.
|
||||
free(*error);
|
||||
*error = nullptr;
|
||||
if (*error != nullptr) {
|
||||
free(*error);
|
||||
*error = nullptr;
|
||||
}
|
||||
|
||||
if (app_snapshot != nullptr) {
|
||||
delete app_snapshot;
|
||||
|
||||
Reference in New Issue
Block a user