config: Rename ret to config

We don't return this configuration, so don't name it ret.
config: Fix a few memory leaks

We were forgetting to unref in a few places.