[splint-discuss] memory leak detection

David Evans evans at cs.virginia.edu
Sat Nov 1 21:58:46 EST 2003

> front-decode.c: (in function main)
> front-decode.c:33:9: Variable this_string is released in false branch, but live
>                         in true branch.
>   The state of a variable is different depending on which branch is taken. This
>   means no annotation can sensibly be applied to the storage. (Use -branchstate
>   to inhibit warning)
>    front-decode.c:33:9: in false branch:
>    front-decode.c:32:18: Storage this_string released
>    front-decode.c:33:9: in true branch:
>    front-decode.c:20:9: Storage this_string defined
> ------------------------------------------------------------------
> What I don't understand is the following: I have two /*@only@*/ strings.
> After the assignment in line 23 this_string should be considered dead
> (according to the manual) but it isn't.

Splint's analysis isn't sophisticated enough to figure this out.  If you

        this_string = NULL;

it will prevent the warning.

--- Dave

More information about the splint-discuss mailing list