Commit 7e4f8165 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Changed free(buffer) to delete [] buffer.

This bug (mismatch between new[] and free) was found by running VC++'s /analyze on all of Chrome.

BUG=chromium:427616
LOG=N
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/686193004

Patch from Bruce Dawson <brucedawson@chromium.org>.

Cr-Commit-Position: refs/heads/master@{#25003}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25003 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e847cd21
......@@ -595,7 +595,7 @@ char* String::ToAsciiArray() {
// Static so that subsequent calls frees previously allocated space.
// This also means that previous results will be overwritten.
static char* buffer = NULL;
if (buffer != NULL) free(buffer);
if (buffer != NULL) delete[] buffer;
buffer = new char[length()+1];
WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length());
buffer[length()] = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment