mirror of
https://git.suyu.dev/suyu/breakpad.git
synced 2026-03-11 05:42:57 +00:00
Fix more memory leaks with proper smart pointer usage
Fix more memory leaks, specifically for Module::Extern and
Module::StackFrameEntry that were outside the Module's AddressRange.
To fix this, and to prevent issues like the one fixed by
79326ebe94
in the future, switched to proper use of std::unique_ptr for Module's
Extern and StackFrameEntry functions. These should enforce ownership
correctly and make the ownership flow much more visible and clear.
Change-Id: I7c943dff3501836a5e303febedc1b312e6f0a1fe
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4129821
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
@@ -36,6 +36,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "common/mac/dump_syms.h"
|
||||
@@ -108,7 +110,8 @@ static void CopyCFIDataBetweenModules(Module* to_module,
|
||||
// If the entry does not overlap, then it is safe to copy to |to_module|.
|
||||
if (to_it == to_data.end() || (from_entry->address < (*to_it)->address &&
|
||||
from_entry_end < (*to_it)->address)) {
|
||||
to_module->AddStackFrameEntry(new Module::StackFrameEntry(*from_entry));
|
||||
to_module->AddStackFrameEntry(
|
||||
std::make_unique<Module::StackFrameEntry>(*from_entry));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user