[clang] [analyzer] Fix a false memory leak reports involving placement new (PR #144341)
Pavel Skripkin via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 16 10:55:16 PDT 2025
================
@@ -1371,6 +1371,19 @@ void MallocChecker::checkIfFreeNameIndex(ProgramStateRef State,
C.addTransition(State);
}
+const Expr *getPlacementNewBufferArg(const CallExpr *CE,
+ const FunctionDecl *FD) {
+ // Checking for signature:
+ // void* operator new ( std::size_t count, void* ptr );
+ // void* operator new[]( std::size_t count, void* ptr );
+ if (CE->getNumArgs() != 2)
----------------
pskrgag wrote:
What about (weird) overload like like
```
void operator delete(void*, void *);
```
Likely bind on 1405 won't hurt, since `operator delete` should return void. I guess it's better to check that `FD->getOverloadedOperator() == OO_new`
https://github.com/llvm/llvm-project/pull/144341
More information about the cfe-commits
mailing list