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