common: Add auto-unref helper