mirror of
https://github.com/yuzu-emu/breakpad
synced 2024-11-22 10:33:36 +00:00
Fix memory leak in Module::AddExtern
If adding a duplicate extern, we need to `delete` the extra `Extern` object regardless of the value of enable_multiple_field_. Fixes ASAN build of ChromeOS: https://logs.chromium.org/logs/chromeos/buildbucket/cr-buildbucket/8793433395207218433/+/u/run_ebuild_tests/chromeos-base_google-breakpad_log BUG=b:263148951 Change-Id: Ib6c20e9c7aa38b1530e4bac8acbf481cc9136c36 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4129701 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
This commit is contained in:
parent
6e03dc0f20
commit
79326ebe94
1 changed files with 4 additions and 2 deletions
|
@ -208,8 +208,10 @@ void Module::AddExtern(Extern* ext) {
|
|||
}
|
||||
|
||||
std::pair<ExternSet::iterator,bool> ret = externs_.insert(ext);
|
||||
if (!ret.second && enable_multiple_field_) {
|
||||
(*ret.first)->is_multiple = true;
|
||||
if (!ret.second) {
|
||||
if (enable_multiple_field_) {
|
||||
(*ret.first)->is_multiple = true;
|
||||
}
|
||||
// Free the duplicate that was not inserted because this Module
|
||||
// now owns it.
|
||||
delete ext;
|
||||
|
|
Loading…
Reference in a new issue