Some consistency changes to library & headers flags.
[splint-patched.git] / test / linked6.c
blob0c532057334efa04e1ed4158ae92b07804506366
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 extern void keeper (/*@keep@*/ item iv);
14 void node_free1 (/*@only@*/ node n)
16 free (n); /* 2 errors: must free n->next, n->val */
19 void node_free2 (/*@only@*/ node n)
21 node nn = n->next;
22 keeper (n->val);
23 free (n); /* okay */
24 } /* error - nn not released */
26 void node_free3 (/*@only@*/ node n)
28 node nn = n->next;
29 keeper (n->val);
30 free (n); /* okay */
31 if (nn != NULL) {
32 node_free1 (nn); /* okay (error for null) */
34 } /* okay */