[PATCH] D124567: [dsymutil] Fix memory issue in the BinaryHolder

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 27 16:21:54 PDT 2022


JDevlieghere marked an inline comment as done.
JDevlieghere added inline comments.


================
Comment at: llvm/tools/dsymutil/BinaryHolder.cpp:231
   std::lock_guard<std::mutex> Lock(MemberCacheMutex);
-  MemberCache.try_emplace(Key, std::move(OE));
-  return MemberCache[Key];
+  MemberCache[Key] = std::move(OE);
+  return *MemberCache[Key];
----------------
vsk wrote:
> I think we can end up with two distinct ObjectEntry's (at different addresses) for the same {filename, timestamp} key, because archive loading is racy. Is that ok?
That's a good point. I guess there's no better way to avoid that than by locking the during the whole loading sequence.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124567/new/

https://reviews.llvm.org/D124567



More information about the llvm-commits mailing list