[msan] Remove alloc-dealloc mismatch

A std::unique_ptr of array type uses the "delete[]" operator to delete
the memory, hence we should use "new[]" to allocate it.
I sometimes get this reported locally, even though I have
"alloc_dealloc_mismatch=0" in ASAN_OPTIONS. So why not just fix it.

R=marja@chromium.org

Bug: v8:7754
Change-Id: I026287a0e0ee4b9560c4fc7333267e738392b13f
Reviewed-on: https://chromium-review.googlesource.com/1057230
Reviewed-by: Marja Hölttä <marja@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53154}
This commit is contained in:
Clemens Hammacher 2018-05-14 14:54:14 +02:00 committed by Commit Bot
parent 7927d6468e
commit ac357002ad

View File

@ -276,7 +276,9 @@ std::unique_ptr<char[]> FunctionLiteral::GetDebugName() const {
AllowHandleDereference allow_deref;
return inferred_name_->ToCString();
} else {
return std::unique_ptr<char[]>(new char{'\0'});
char* empty_str = new char[1];
empty_str[0] = 0;
return std::unique_ptr<char[]>(empty_str);
}
// TODO(rmcilroy): Deal with two-character strings.