Some consistency changes to library & headers flags.
[splint-patched.git] / test / linked4.c
blob6966342f88be1de8ef9e058406121d6961c4392f
1 typedef struct _node *node;
3 typedef struct {
4 char *val;
5 } *item;
7 struct _node {
8 /*@only@*/ item val;
9 /*@null@*/ node next;
12 void node_free1 (/*@only@*/ node n)
14 free (n); /* 2 errors: must free n->next, n->val */
17 void node_free2 (/*@only@*/ node n)
19 node nn = n->next;
20 free (n); /* error: must free n->val */
21 } /* error - nn not released */
23 void node_free3 (/*@only@*/ node n)
25 node nn = n->next;
26 free (n->val);
27 free (n); /* okay */
28 if (nn != NULL) {
29 node_free1 (nn); /* okay (error for null) */
31 } /* okay */