C言語でデストラクタ及びスマートポインタを実装した人が居るらしい。何というタイミング。GCC拡張のcleanup attributeを使っているので、使い道は少なそう。それと、メモリをスタックからじゃなくてヒープから取得してるのが気になる。
[C] Implementing smart pointers for the C programming language
http://snaipe.me/c/c-smart-pointers/
https://github.com/Snaipe/c-smart-pointers