Fix dangling pointer in forward_ref_die_to_func

Bug: google-breakpad:843
Change-Id: I14358b239604e1faeb5a8c4c4734102571dbed09
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2951787
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Zequan Wu 2021-06-10 11:09:24 -07:00 committed by Mike Frysinger
parent 322eb2b4c6
commit a524a1e24b
5 changed files with 26 additions and 22 deletions

View file

@ -80,13 +80,13 @@ void Module::SetAddressRanges(const vector<Range>& ranges) {
address_ranges_ = ranges;
}
void Module::AddFunction(Function* function) {
bool Module::AddFunction(Function* function) {
// FUNC lines must not hold an empty name, so catch the problem early if
// callers try to add one.
assert(!function->name.empty());
if (!AddressIsInModule(function->address)) {
return;
return false;
}
// FUNCs are better than PUBLICs as they come with sizes, so remove an extern
@ -120,14 +120,9 @@ void Module::AddFunction(Function* function) {
if (!ret.second && (*ret.first != function)) {
// Free the duplicate that was not inserted because this Module
// now owns it.
delete function;
return false;
}
}
void Module::AddFunctions(vector<Function*>::iterator begin,
vector<Function*>::iterator end) {
for (vector<Function*>::iterator it = begin; it != end; ++it)
AddFunction(*it);
return true;
}
void Module::AddStackFrameEntry(StackFrameEntry* stack_frame_entry) {