gcc/testsuite/c-c++-common/analyzer/pr98918.c
raw| 1 | /* { dg-additional-options "-Wno-analyzer-symbol-too-complex" } */ |
| 2 | /* { dg-skip-if "requires hosted libstdc++ for stdlib free" { ! hostedlib } } */ |
| 3 | |
| 4 | #include <stdlib.h> |
| 5 | |
| 6 | struct marker { |
| 7 | struct marker *next; |
| 8 | void *ref; |
| 9 | }; |
| 10 | struct data { |
| 11 | struct marker *marker; |
| 12 | }; |
| 13 | |
| 14 | void data_free(struct data d) |
| 15 | { |
| 16 | struct marker *nm, *m; |
| 17 | |
| 18 | m = d.marker; |
| 19 | while (m) { |
| 20 | nm = m->next; |
| 21 | free(m->ref); |
| 22 | free(m); |
| 23 | m = nm; |
| 24 | } |
| 25 | } |