mainloop: Deinit the dns thread cache when reverting the config

When reloading the configuration and the new config fails to initialize,
syslog-ng reverts to the old config. But by that time,
dns_cache_thread_init() has already been called (when trying to init the
new config), and dns_cache_thread_deinit() never got called. So when we
tried to cfg_init() the old config, it called dns_cache_thread_init()
again, and triggered an assertion.

To fix the issue, the main thread's dns_cache_thread_init()/_deinit()
were moved to apphook instead, and dropped from cfg_init()/cfg_deinit().

Reported-by: Andras Mitzki <micek@balabit.hu>
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Merge pull request #34 from balabit/merge/h/cfg-old-reload-crash

mainloop: Deinit the dns thread cache when reverting the config