[PATCH] D39208: [Analyzer] Do not use static storage to for implementations created in BodyFarm.cpp

George Karpenkov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 24 15:57:12 PDT 2017


george.karpenkov added inline comments.


================
Comment at: cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp:607
+AnalysisDeclContextManager::~AnalysisDeclContextManager() {
+  if (!BdyFrm)
+    delete BdyFrm;
----------------
alexfh wrote:
> This is an almost guaranteed memory leak. I think, you meant `if (BdyFrm) delete BdyFrm;`. But `delete` deals well with `nullptr`, so just delete the pointer unconditionally. But first consider making `BdyFrm` a `std::unique_ptr`. From a cursory look I don't see any reasons not to.
@alexfh yes, this was fixed.
Also, yes, https://reviews.llvm.org/D39220


Repository:
  rL LLVM

https://reviews.llvm.org/D39208





More information about the cfe-commits mailing list