blob: a08386a46266cdc1e737cffc720f17a2e7f74b6f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
/* { dg-additional-options "-fanalyzer-verbosity=1" } */
#include <stdlib.h>
void
calls_free (void *victim)
{
free (victim); /* { dg-warning "double-'free' of 'victim'" } */
}
extern void do_stuff (void);
struct foo
{
void *m_p;
};
void test (struct foo f)
{
do_stuff ();
calls_free (f.m_p);
do_stuff ();
calls_free (f.m_p); /* { dg-message "passing freed pointer 'f\\.m_p' in call to 'calls_free' from 'test'" } */
do_stuff ();
}
|