home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
splint3s.zip
/
splint-3.0.1.6
/
test
/
linked2.c
< prev
next >
Wrap
C/C++ Source or Header
|
2001-07-03
|
471b
|
26 lines
typedef struct _node *node;
struct _node {
int val;
/*@dependent@*/ /*@null@*/ node next;
}
void node_free1 (/*@only@*/ node n)
{
free (n); /* error: must free n->next */
}
void node_free2 (/*@only@*/ node n)
{
node nn = n->next;
free (n); /* okay */
} /* okay - no need to free nn since it is dependent */
void node_free3 (/*@only@*/ node n)
{
node nn = n->next;
free (n); /* okay */
node_free1 (nn); /* error: dependent at only */
} /* okay */