From 7e4f81653fc48ebb776260544fb8dbd4fc9ffa5a Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Thu, 30 Oct 2014 07:41:09 +0000 Subject: [PATCH] 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 . Cr-Commit-Position: refs/heads/master@{#25003} git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25003 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/objects-printer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/objects-printer.cc b/src/objects-printer.cc index 75e2ed1..cce2b8b 100644 --- a/src/objects-printer.cc +++ b/src/objects-printer.cc @@ -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(buffer), 0, length()); buffer[length()] = 0; -- 2.7.4