So I'm wrapping some DirectShow stuff with JNI so I can get to it in Java ... One of the really nice constructs in Java is the try { .. } finally { ..} where finally is always executed no matter how the try block exists, so you can clean up nicely. Is there any equivalent to this in C or some mechanism that makes cleaning things up easier? For instance, I have a bunch of COM objects that need to get ->Release()'d, and it's pretty damn annoying trying to keep track of who is referenced at every failure point. Especially if you properly check error results -- every single call can return a failure HRESULT and potentially requires a cleanup afterwards. Any tricks of the trade would be appreciated ... I'm so spoiled from Java with not having to care about garbage collection -- that's probably the most annoying thing about doing non-Java stuff so far.

ms