diff options
| author | 2014-12-11 14:09:51 -0800 | |
|---|---|---|
| committer | 2014-12-11 14:09:51 -0800 | |
| commit | 6fc59abce810b87b6fb07dbd1e84f9dca02fd487 (patch) | |
| tree | 775c024115ea1815764c02bb37967f96959572e6 | |
| parent | 84c132dd431c37cd381d1e20210b185f87d512f3 (diff) | |
Fix alloc-dealloc-mismatch failures in dex2oat.
These errors are for calling `delete` on something allocated with
`new[]`.
Bug: 18202869
Change-Id: I8032664dd0819740e83a04cd5a0d56e2c097aacf
| -rw-r--r-- | dex2oat/dex2oat.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index 00661f4932..e83f626a39 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -548,7 +548,7 @@ class Dex2Oat FINAL { } else if (option.starts_with("--instruction-set=")) { StringPiece instruction_set_str = option.substr(strlen("--instruction-set=")).data(); // StringPiece is not necessarily zero-terminated, so need to make a copy and ensure it. - std::unique_ptr<char> buf(new char[instruction_set_str.length() + 1]); + std::unique_ptr<char[]> buf(new char[instruction_set_str.length() + 1]); strncpy(buf.get(), instruction_set_str.data(), instruction_set_str.length()); buf.get()[instruction_set_str.length()] = 0; instruction_set_ = GetInstructionSetFromString(buf.get()); @@ -1321,7 +1321,7 @@ class Dex2Oat FINAL { std::unique_ptr<File> in(OS::OpenFileForReading(oat_unstripped_.c_str())); std::unique_ptr<File> out(OS::CreateEmptyFile(oat_stripped_.c_str())); size_t buffer_size = 8192; - std::unique_ptr<uint8_t> buffer(new uint8_t[buffer_size]); + std::unique_ptr<uint8_t[]> buffer(new uint8_t[buffer_size]); while (true) { int bytes_read = TEMP_FAILURE_RETRY(read(in->Fd(), buffer.get(), buffer_size)); if (bytes_read <= 0) { |