1 #include <stdlib.h>
2 
3 void *
calls_malloc(void)4 calls_malloc (void)
5 {
6   void *result = malloc (1024);
7   return result;
8 }
9 
10 void
calls_free(void * victim)11 calls_free (void *victim)
12 {
13   free (victim); /* { dg-warning "double-'free' of 'victim'" } */
14   /* TODO: this would be better emitted at the callsite,
15      for such a simple wrapper.  */
16 }
17 
test(void)18 void test (void)
19 {
20   void *ptr = calls_malloc ();
21   calls_free (ptr);
22   calls_free (ptr); /* BUG: double-'free'.  */
23 }
24