aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/pr98918.c
blob: eddc4e30684ee5ea3ea96528576acb8fec167732 (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
/* { dg-additional-options "-Wno-analyzer-symbol-too-complex" } */
/* { dg-skip-if "requires hosted libstdc++ for stdlib free" { ! hostedlib } } */

#include <stdlib.h>

struct marker {
  struct marker *next;
  void *ref;
};
struct data {
  struct marker *marker;
};

void data_free(struct data d)
{
  struct marker *nm, *m;

  m = d.marker;
  while (m) {
    nm = m->next;
    free(m->ref);
    free(m);
    m = nm;
  }
}