Skip to content

Commit f1e32c1

Browse files
authored
Properly release storage on exit (#1829)
1 parent 57ffa1f commit f1e32c1

File tree

2 files changed

+4
-4
lines changed
  • firebase-crashlytics-ndk/src/main/jni/libcrashlytics

2 files changed

+4
-4
lines changed

firebase-crashlytics-ndk/src/main/jni/libcrashlytics/include/crashlytics/detail/memory/allocate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ inline T* allocate_storage(U&& initial) noexcept
8585
template<typename T>
8686
inline void release_storage(T* storage)
8787
{
88-
if (detail::duration(storage) == detail::Mmap) {
88+
if (storage != nullptr && detail::duration(storage) == detail::Mmap) {
8989
//! Deallocate only if there was no fallback to static storage.
9090
page_allocator<T>().deallocate(storage, sizeof (T));
9191
}

firebase-crashlytics-ndk/src/main/jni/libcrashlytics/src/handler/install.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ inline void make_suppliment_path_from(const char* path, const char* suffix, char
6767
void finalize()
6868
{
6969
DEBUG_OUT("Finalizing");
70-
detail::breakpad_context* context = reinterpret_cast<detail::breakpad_context *>(detail::instance.load());
71-
delete context;
70+
breakpad_context* context = reinterpret_cast<breakpad_context *>(instance.load());
71+
crashlytics::detail::memory::release_storage<breakpad_context>(context);
7272
}
7373

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

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

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

0 commit comments

Comments
 (0)