[PATCH] D139534: [analyzer] Don't escape local static memregions on bind
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 15 13:19:39 PST 2022
NoQ added inline comments.
================
Comment at: clang/test/Analysis/malloc-static-storage.cpp:33-38
+void malloc_escape() {
+ static int *p;
+ p = (int *)malloc(sizeof(int));
+ escape(p); // no-leak
+ p = 0; // no-leak
+}
----------------
The main problem with static locals is that this can happen the other way round:
```lang=c
void malloc_escape() {
static int *p;
escape(p);
p = (int *)malloc(sizeof(int));
p = 0; // no-leak
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139534/new/
https://reviews.llvm.org/D139534
More information about the cfe-commits
mailing list