aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSiyangXie@gmail.com <SiyangXie@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-11-01 22:10:10 +0000
committerSiyangXie@gmail.com <SiyangXie@gmail.com@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-11-01 22:10:10 +0000
commit3382d1e0a6ed8f34ff20777475aea6624c463667 (patch)
tree3699020b5e2660d69416373f8d84978995d79bad /src
parentRestrict ownership of symbol data buffers to symbol supplier. (diff)
downloadbreakpad-3382d1e0a6ed8f34ff20777475aea6624c463667.tar.xz
Tiny fix for memory allocation/deallocation mismatch
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@722 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src')
-rw-r--r--src/google_breakpad/processor/source_line_resolver_base.h2
-rw-r--r--src/processor/fast_source_line_resolver_unittest.cc2
-rw-r--r--src/processor/module_serializer.h4
3 files changed, 7 insertions, 1 deletions
diff --git a/src/google_breakpad/processor/source_line_resolver_base.h b/src/google_breakpad/processor/source_line_resolver_base.h
index d950a736..efa76e7e 100644
--- a/src/google_breakpad/processor/source_line_resolver_base.h
+++ b/src/google_breakpad/processor/source_line_resolver_base.h
@@ -60,6 +60,8 @@ class SourceLineResolverBase : public SourceLineResolverInterface {
// Read the symbol_data from a file with given file_name.
// The part of code was originally in BasicSourceLineResolver::Module's
// LoadMap() method.
+ // Place dynamically allocated heap buffer in symbol_data. Caller has the
+ // ownership of the buffer, and should call delete [] to free the buffer.
static bool ReadSymbolFile(char **symbol_data, const string &file_name);
protected:
diff --git a/src/processor/fast_source_line_resolver_unittest.cc b/src/processor/fast_source_line_resolver_unittest.cc
index 6a9bcb14..a4a92097 100644
--- a/src/processor/fast_source_line_resolver_unittest.cc
+++ b/src/processor/fast_source_line_resolver_unittest.cc
@@ -464,7 +464,7 @@ TEST_F(TestFastSourceLineResolver, CompareModule) {
ASSERT_TRUE(SourceLineResolverBase::ReadSymbolFile(
&symbol_data, symbol_file(module_index)));
symbol_data_string = symbol_data;
- delete symbol_data;
+ delete [] symbol_data;
ASSERT_TRUE(module_comparer.Compare(symbol_data_string));
}
}
diff --git a/src/processor/module_serializer.h b/src/processor/module_serializer.h
index 1c7bfd47..7a05827d 100644
--- a/src/processor/module_serializer.h
+++ b/src/processor/module_serializer.h
@@ -70,10 +70,14 @@ class ModuleSerializer {
// Serializes a loaded Module object into a chunk of memory data and returns
// the address of memory chunk. If size != NULL, *size is set to the memory
// size allocated for the serialized data.
+ // Caller takes the ownership of the memory chunk (allocated on heap), and
+ // should call delete instead of delete [] to free it.
char* Serialize(const BasicSourceLineResolver::Module &module,
unsigned int *size = NULL);
// Given the string format symbol_data, produces a chunk of serialized data.
+ // Caller takes ownership of the serialized data (on heap), and should call
+ // delete instead of delete [] to free it.
char* SerializeSymbolFileData(const string &symbol_data,
unsigned int *size = NULL);