Fix assertion failure in WriteMappings() for zero modules

If there were no mappings where ShouldIncludeMapping() returned true,
AllocateObjectAndArray() would die with an assertion failure.

BUG=chrome-os-partner:14914
TEST=Ran unittests
Review URL: https://breakpad.appspot.com/492002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1081 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
mkrebs@chromium.org 2012-11-14 22:01:35 +00:00
parent bbcdd7711f
commit 1b75bf9f8a

View file

@ -834,8 +834,15 @@ class MinidumpWriter {
}
TypedMDRVA<uint32_t> list(&minidump_writer_);
if (num_output_mappings) {
if (!list.AllocateObjectAndArray(num_output_mappings, MD_MODULE_SIZE))
return false;
} else {
// Still create the module list stream, although it will have zero
// modules.
if (!list.Allocate())
return false;
}
dirent->stream_type = MD_MODULE_LIST_STREAM;
dirent->location = list.location();