[PATCH] D136826: [clang][Interp] Make sure we free() allocated InitMaps

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 28 12:12:01 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/lib/AST/Interp/Descriptor.cpp:46
+
+  Ptr += sizeof(InitMap *);
   for (unsigned I = 0, NE = D->getNumElems(); I < NE; ++I) {
----------------
shafik wrote:
> I believe `Ptr` is not longer valid b/c of `free(IM)` b/c what `Ptr` points to has not been free'ed 
> 
> I am looking at the wording now but I am curious what @aaron.ballman thinks.
How I see it is that it's converting `Ptr` to an `IntMap **`, dereferencing that back to `IntMap *` and then freeing *that* pointer. So it doesn't free `Ptr` itself, but what `Ptr` points to.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136826



More information about the cfe-commits mailing list