Various minor fixes for compiler/linter (other then splint itself) warnings.
[splint-patched.git] / test / linked2.c
blob6e3b11f458da5971ea01eaf8445c2029cd9e8fa3
1 typedef struct _node *node;
3 struct _node {
4 int val;
5 /*@dependent@*/ /*@null@*/ node next;
8 void node_free1 (/*@only@*/ node n)
10 free (n); /* error: must free n->next */
13 void node_free2 (/*@only@*/ node n)
15 node nn = n->next;
16 free (n); /* okay */
17 } /* okay - no need to free nn since it is dependent */
19 void node_free3 (/*@only@*/ node n)
21 node nn = n->next;
22 free (n); /* okay */
23 node_free1 (nn); /* error: dependent at only */
24 } /* okay */