[clang] 9fe23fb - [NFC][analyzer] Fix static analyzer concerns

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 28 05:32:09 PDT 2023


Author: Podchishchaeva, Mariya
Date: 2023-07-28T05:30:34-07:00
New Revision: 9fe23fbb2318f86eab0a8404c5024ee04f1eb83d

URL: https://github.com/llvm/llvm-project/commit/9fe23fbb2318f86eab0a8404c5024ee04f1eb83d
DIFF: https://github.com/llvm/llvm-project/commit/9fe23fbb2318f86eab0a8404c5024ee04f1eb83d.diff

LOG: [NFC][analyzer] Fix static analyzer concerns

CFGStmtMap frees resources in the destructor but doesn't
have user-written copy c'tor or assignment operator, so copying it using
default ones can cause double free.

Reviewed By: cor3ntin

Differential Revision: https://reviews.llvm.org/D156415

Added: 
    

Modified: 
    clang/include/clang/Analysis/CFGStmtMap.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Analysis/CFGStmtMap.h b/clang/include/clang/Analysis/CFGStmtMap.h
index 8cf02372ff0fb7..93cd9cfc5bdff2 100644
--- a/clang/include/clang/Analysis/CFGStmtMap.h
+++ b/clang/include/clang/Analysis/CFGStmtMap.h
@@ -26,6 +26,8 @@ class CFGStmtMap {
   void *M;
 
   CFGStmtMap(ParentMap *pm, void *m) : PM(pm), M(m) {}
+  CFGStmtMap(const CFGStmtMap &) = delete;
+  CFGStmtMap &operator=(const CFGStmtMap &) = delete;
 
 public:
   ~CFGStmtMap();


        


More information about the cfe-commits mailing list