mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-02-19 08:42:59 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user