From a4d055f1c2882da708b72a11a3505277cc7f088f Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Tue, 17 Dec 2013 19:04:11 +0000 Subject: [PATCH] Fix error r1258. BUG=556 R=cdn@chromium.org, mark@chromium.org Review URL: https://breakpad.appspot.com/904004 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1262 4c0a9323-5329-0410-9bdc-e9ce6186880e --- .../crash_generation/minidump_generator.cc | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/client/windows/crash_generation/minidump_generator.cc b/src/client/windows/crash_generation/minidump_generator.cc index fa6809b6..652c1c9a 100644 --- a/src/client/windows/crash_generation/minidump_generator.cc +++ b/src/client/windows/crash_generation/minidump_generator.cc @@ -437,10 +437,10 @@ bool MinidumpGenerator::WriteMinidump( breakpad_info.requesting_thread_id = requesting_thread_id; } + int additional_streams_count = additional_streams ? + additional_streams->UserStreamCount : 0; scoped_array user_stream_array( - new MINIDUMP_USER_STREAM[3 + additional_streams ? - additional_streams->UserStreamCount : - 0]); + new MINIDUMP_USER_STREAM[3 + additional_streams_count]); user_stream_array[0].Type = MD_BREAKPAD_INFO_STREAM; user_stream_array[0].BufferSize = sizeof(breakpad_info); user_stream_array[0].Buffer = &breakpad_info; @@ -484,15 +484,17 @@ bool MinidumpGenerator::WriteMinidump( ++user_streams.UserStreamCount; } - for (size_t i = 0; - additional_streams != NULL, i < additional_streams->UserStreamCount; - i++, user_streams.UserStreamCount++) { - user_stream_array[user_streams.UserStreamCount].Type = - additional_streams->UserStreamArray[i].Type; - user_stream_array[user_streams.UserStreamCount].BufferSize = - additional_streams->UserStreamArray[i].BufferSize; - user_stream_array[user_streams.UserStreamCount].Buffer = - additional_streams->UserStreamArray[i].Buffer; + if (additional_streams) { + for (size_t i = 0; + i < additional_streams->UserStreamCount; + i++, user_streams.UserStreamCount++) { + user_stream_array[user_streams.UserStreamCount].Type = + additional_streams->UserStreamArray[i].Type; + user_stream_array[user_streams.UserStreamCount].BufferSize = + additional_streams->UserStreamArray[i].BufferSize; + user_stream_array[user_streams.UserStreamCount].Buffer = + additional_streams->UserStreamArray[i].Buffer; + } } // If the process is terminated by STATUS_INVALID_HANDLE exception store