leak of ‘ptr [-Wanalyzer-malloc-leak]
14 } // { dg-warning "leak of 'ptr'" }
^
int test()
int test(): events 1-4
5 void *ptr = __builtin_malloc (1024); // { dg-message "allocated here" }
~~~~~~~~~~~~~~~~~^~~~~~
|
(1) allocated here
[...]
9 throw 42;
~~
|
(2) throwing exception of type ‘int’ here...
10 }
11 catch (int i) // { dg-message "\.\.\.catching exception of type 'int' here" }
~
|
(3) ...catching exception of type ‘int’ here
[...]
14 } // { dg-warning "leak of 'ptr'" }
~
|
(4) ⚠️ ‘ptr’ leaks here; was allocated at (1)