Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/malloc-4.c

raw
1 /* { dg-additional-options "-Wno-incompatible-pointer-types" } */
2 /* C only: Wno-incompatible-pointer-types is not valid for C++. */
3
4 #include <stdlib.h>
5
6 struct foo;
7 struct bar;
8 void *hv (struct foo **tm)
9 {
10 void *p = __builtin_malloc (4);
11 *tm = (struct foo *) p;
12 if (!p)
13 abort ();
14 return p;
15 }
16
17 void a5 (void)
18 {
19 struct bar *qb = NULL;
20 hv ((struct foo **) &qb);
21 } /* { dg-warning "leak of 'qb'" } */