aboutsummaryrefslogtreecommitdiff
path: root/src/processor
diff options
context:
space:
mode:
authorIvan Penkov <ivanpe@chromium.org>2016-03-11 16:37:46 -0800
committerIvan Penkov <ivanpe@chromium.org>2016-03-11 16:37:46 -0800
commitebba1800e4bb5ffad3533e6bf01978b578eea91a (patch)
treed3fa045585bec984d165764b4ab6d885dcf28d6f /src/processor
parentFix format warning in omap.cc (diff)
downloadbreakpad-ebba1800e4bb5ffad3533e6bf01978b578eea91a.tar.xz
Explicitly call non-sized delete on dynamically sized memory for correct behavior under sized-delete.
The code as it stands allocates a chunk of memory of arbitrary size and places an object into it. It stores a pointer to that object and memory into a list telling the compiler that it is a pointer to a char. When the compiler deletes the objects in the list it thinks that the list contains pointers to chars - not pointers to arbitrarily sized regions of memory. This is fixing an issue that will reproduces when the following optimization (C++ sized dealocation) is enabled: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3536.html The fix is to explicitly call the non-sized delete operator, and the library code that supports malloc/free/new/delete will figure out the size of the block of memory from the pointer being passed in. Patch provided by Darryl Gove. R=mark@chromium.org Review URL: https://codereview.chromium.org/1788473002 .
Diffstat (limited to 'src/processor')
-rw-r--r--src/processor/static_map_unittest.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/processor/static_map_unittest.cc b/src/processor/static_map_unittest.cc
index 97b1e61a..393d43d5 100644
--- a/src/processor/static_map_unittest.cc
+++ b/src/processor/static_map_unittest.cc
@@ -180,7 +180,7 @@ class TestValidMap : public ::testing::Test {
void TearDown() {
for (int i = 0;i < kNumberTestCases; ++i)
- delete map_data[i];
+ ::operator delete(map_data[i]);
}