Make memory allocation/deallocation consistent: use new char[] instead of operator new()

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@724 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
SiyangXie@gmail.com
2010-11-03 23:54:01 +00:00
parent 3b4ac42ff8
commit bbd8e82a7f
6 changed files with 26 additions and 28 deletions

View File

@@ -102,8 +102,7 @@ char *StdMapSerializer<Key, Value>::Serialize(
// Compute size of memory to be allocated.
unsigned int size_to_alloc = SizeOf(m);
// Allocate memory.
char *serialized_data =
reinterpret_cast<char*>(operator new(size_to_alloc));
char *serialized_data = new char[size_to_alloc];
if (!serialized_data) {
BPLOG(INFO) << "StdMapSerializer memory allocation failed.";
if (size) *size = 0;
@@ -172,8 +171,7 @@ char *RangeMapSerializer<Address, Entry>::Serialize(
// Compute size of memory to be allocated.
unsigned int size_to_alloc = SizeOf(m);
// Allocate memory.
char *serialized_data =
reinterpret_cast<char*>(operator new(size_to_alloc));
char *serialized_data = new char[size_to_alloc];
if (!serialized_data) {
BPLOG(INFO) << "RangeMapSerializer memory allocation failed.";
if (size) *size = 0;
@@ -252,7 +250,7 @@ char *ContainedRangeMapSerializer<AddrType, EntryType>::Serialize(
const ContainedRangeMap<AddrType, EntryType> *m, unsigned int *size) const {
unsigned int size_to_alloc = SizeOf(m);
// Allocating memory.
char *serialized_data = reinterpret_cast<char*>(operator new(size_to_alloc));
char *serialized_data = new char[size_to_alloc];
if (!serialized_data) {
BPLOG(INFO) << "ContainedRangeMapSerializer memory allocation failed.";
if (size) *size = 0;