I am currently experimenting with static ownership checks for C, aiming to provide guarantees that resources are released when necessary.
As this is a work in progress, bugs are expected. More flow analysis is required.
Despite that, you can still try out the checks online and observe some helpful error messages.
Simply visit the website below and select the 'Extension - Ownership' samples.
http://thradams.com/cake/playground.html
The C type system was extended with some new qualifiers. But only with flow analysis is possible to understand when variables goes out of scope or understand when the variables have been move before the end of scope.
As I said, this is a work in progress but I am already very optimistic.