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
+}
----------------
NoQ wrote:
> 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
> }
> ```
Wait, I misread. I'm thinking of a situation like this:
```
void malloc_escape() {
  static int *p;
  escape(&p); // added '&'
  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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to