aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/file-2.c
blob: aa0457071eaf9121402499940fdd2cf964b41da6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>

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'" } */
}