[BOLT][NFC] Fix possible use-after-free
authorrevunov.denis@huawei.com <revunov.denis@huawei-partners.com>
Mon, 14 Nov 2022 13:25:20 +0000 (13:25 +0000)
committerrevunov.denis@huawei.com <revunov.denis@huawei-partners.com>
Mon, 14 Nov 2022 13:30:22 +0000 (13:30 +0000)
commitc92ff2a3c449d2de502dc8444a0fdad5b4c42ff4
tree16ea4d8ef383f2f401e0974c9c0445842e91fc78
parent044fcfa1ed76a0156610b2dc21c9f860381f31f4
[BOLT][NFC] Fix possible use-after-free

If NewName twine has reference to the old name, then after
Section.Name = NewName.str(); this reference is invalidated,
so we cannot use NewName.str() anymore.

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D137616
bolt/lib/Core/BinaryContext.cpp