Don't try calling lsl when file is missing.
[splint-patched.git] / test / sharing5.c
blobfd585a5f267ad7a4e0bdc764e0367fda591d2c72
1 extern void free (/*@out@*/ /*@only@*/ void *s);
2 extern /*@only@*/ char *string_copy (char *s);
4 void f(/*@only@*/ char *only1, /*@only@*/ char *only2, /*@only@*/ char *only3,
5 /*@shared@*/ char *shared)
7 char *local1, *local2, *local4;
8 char **localp;
10 local1 = only1;
11 *only1 = 'c'; /* okay */
12 free (local1); /* okay --- kills only1 */
13 *only1 = 'c'; /* 1. bad --- only1 is dead */
15 if (3 > 4)
17 local2 = only2;
19 else
21 local2 = shared;
22 } /* 2. Clauses exit with local2 referencing dependant storage in true */
24 free (local2); /* 3. bad --- could free shared2 (may kill only2) */
26 localp = malloc(sizeof(char *));
27 *localp = only3; /* 4. possible null deref */
29 local4 = only3;
30 local4 = NULL; /* okay */
32 localp = &only3; /* 5. new storage not released */
33 } /* 6. only3 may not be released [[[ only2 ??? ]]] */