mirror of
https://github.com/yuzu-emu/breakpad
synced 2024-11-22 21:43:38 +00:00
stabs_to_module: fix memory leak
Everything in `functions_` is owned by the current `StabsToModule`. If we fail to add something from `functions_`, we need to be sure to dispose of it properly, since `module_` will not take ownership. Bug: b:235999011 Change-Id: I3b965709ea2016a065b50588f4132d14a1de7725 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/3756733 Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
parent
9a1941fab9
commit
4b7984b351
1 changed files with 4 additions and 2 deletions
|
@ -192,9 +192,11 @@ void StabsToModule::Finalize() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now that everything has a size, add our functions to the module, and
|
// Now that everything has a size, add our functions to the module, and
|
||||||
// dispose of our private list.
|
// dispose of our private list. Delete the functions that we fail to add, so
|
||||||
|
// they aren't leaked.
|
||||||
for (Module::Function* func: functions_)
|
for (Module::Function* func: functions_)
|
||||||
module_->AddFunction(func);
|
if (!module_->AddFunction(func))
|
||||||
|
delete func;
|
||||||
functions_.clear();
|
functions_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue