blob: 9c58108a5312b6e6f85a9a1a1d7dc6bdf0c8c34d (
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
|
typedef struct FILE FILE;
FILE* fopen (const char*, const char*);
int fclose (FILE*);
struct foo
{
FILE *m_f;
};
void test (const char *path)
{
struct foo f;
f.m_f = fopen (path, "r");
if (!f.m_f)
return; /* { dg-bogus "leak of FILE" } */
fclose (f.m_f);
fclose (f.m_f); /* { dg-warning "double 'fclose' of FILE 'f.m_f'" } */
}
/* Swallow -Wuse-after-free issued for the same problem
{ dg-prune-output "-Wuse-after-free" } */
|