[LLDB][Reliability] Fix accessing invalid iterator
authorSlava Gurevich <sgurevich@gmail.com>
Thu, 21 Jul 2022 22:04:04 +0000 (15:04 -0700)
committerSlava Gurevich <sgurevich@gmail.com>
Fri, 22 Jul 2022 00:39:11 +0000 (17:39 -0700)
commit98186def3f1f6f3862e6c91ca01dfd278ad1929e
tree50d5bb531a76f28efa06fa88005fd4a8e39f5792
parent02fe96b24018bb8ce65cb264e0621459507cf989
[LLDB][Reliability] Fix accessing invalid iterator

Using invalidated vector iterator is at best a UB and could crash depending on STL implementation.
Fixing via minimal changes to preserve the existing code style.

Coverity warning 1454828  (scan.coverity.com)

Differential Revision: https://reviews.llvm.org/D130312
lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp