Skip to content

Properly release storage on exit #1829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ inline T* allocate_storage(U&& initial) noexcept
template<typename T>
inline void release_storage(T* storage)
{
if (detail::duration(storage) == detail::Mmap) {
if (storage != nullptr && detail::duration(storage) == detail::Mmap) {
//! Deallocate only if there was no fallback to static storage.
page_allocator<T>().deallocate(storage, sizeof (T));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ inline void make_suppliment_path_from(const char* path, const char* suffix, char
void finalize()
{
DEBUG_OUT("Finalizing");
detail::breakpad_context* context = reinterpret_cast<detail::breakpad_context *>(detail::instance.load());
delete context;
breakpad_context* context = reinterpret_cast<breakpad_context *>(instance.load());
crashlytics::detail::memory::release_storage<breakpad_context>(context);
}

} // namespace detail
Expand Down Expand Up @@ -111,7 +111,7 @@ bool detail::breakpad_context::callback(const google_breakpad::MinidumpDescripto
{
const detail::context& handler_context = *reinterpret_cast<detail::context *>(context);

DEBUG_OUT("Path is: %s %s", descriptor.path(), succeeded ? "succeeded" : "failed");
DEBUG_OUT("Path is: %s; generating minidump %s", descriptor.path(), succeeded ? "succeeded" : "failed");

detail::write_supplimentary_file(handler_context, descriptor.path(), ".device_info", [](const detail::context& handler_context, int fd) {
google::crashlytics::handler::write_device_info(handler_context, fd);
Expand Down