Debian Codegraph @

gcc/testsuite/g++.dg/analyzer/cstdlib.C

raw
1 /* { dg-skip-if "requires hosted libstdc++ for cstdlib free" { ! hostedlib } } */
2
3 #include <cstdlib>
4
5 void test_1 (void *ptr)
6 {
7 std::free (ptr); /* { dg-message "first 'free' here" } */
8 std::free (ptr); /* { dg-warning "double-'free' of 'ptr'" } */
9 }
10
11 void test_2 (void)
12 {
13 void *p = std::malloc (1024); /* { dg-message "allocated here" } */
14 } /* { dg-warning "leak of 'p'" } */
15
16 void test_3 (void)
17 {
18 void *p = std::calloc (42, 1024); /* { dg-message "allocated here" } */
19 } /* { dg-warning "leak of 'p'" } */