Debian Codegraph @

gcc/testsuite/gcc.dg/analyzer/use-after-free.c

raw
1 /* { dg-additional-options "-Wno-analyzer-too-complex -Wno-analyzer-symbol-too-complex" } */
2
3 #include <stdlib.h>
4 #include "analyzer-decls.h"
5
6 struct link { struct link *next; };
7
8 int free_a_list_badly (struct link *n)
9 {
10 while (n) {
11 free(n); /* { dg-message "freed here" } */
12 n = n->next; /* { dg-warning "use after 'free' of 'n'" } */
13 }
14 }