COM calls that return a BSTR via an out param pass ownership of the string's underlying memory to the caller. It is the caller's responsibility to free the memory via SysFreeString. Be sure to use CComBSTR in all such cases, so that this happens upon destruction of the CComBSTR. This CL fixes three BSTR memory leaks.
The inline_origins_ member maps an inline origin's name to a unique numerical identifier. Simplify the container by mapping a name only to an id rather than a name to a struct holding the name and id.
These origins are printed ordered by id. Rather than using a std::set to create a container sorted by id, leverage the fact that ids are ints that are assigned sequentially to create the reverse mapping in a std::vector. This greatly reduces heap usage, and reduces complexity to O(N).
Combined, these changes reduce commit charge by 26% and runtime by 10% when processing chrome.dll for a 32-bit win-dcheck build.
Change-Id: Ib8d6540c74622500989f1dc06f705d6846be303f Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/5682242 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>