[PATCH] D153033: [CLANG]Fix potential null pointer dereference bugs

Soumi Manna via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 15 20:52:14 PDT 2023


Manna added inline comments.


================
Comment at: clang/lib/Analysis/ThreadSafety.cpp:505-511
       const unsigned *i = C.lookup(D);
       llvm::errs() << " -> ";
+      if (!i) {
+        llvm::errs() << "<<NULL>>";
+        return;
+      }
       dumpVarDefinitionName(*i);
----------------
aaronpuchert wrote:
> Can't we just take `I.getData()` instead of doing a lookup? After all we're iterating over the same map.
Thank you @aaronpuchert for review and comment.  

>>Can't we just take I.getData() instead of doing a lookup? After all we're iterating over the same map.

Makes sense to me! I have updated patch


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

https://reviews.llvm.org/D153033



More information about the cfe-commits mailing list