cfg-tree: Added a few tests for cfg-tree

These are some simplistic tests for cfg-tree, that verify some of the
functionality provided. In particular, this tests cfg_tree_start() and
cfg_tree_stop() in a few conditions, using only a simplistic LogPipe.

The intent is to check that cfg_tree_start() initializes only those
pipes that can be and nothing after, and cfg_tree_stop() deinits those
that were initialized before.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
mainloop: Deinit the new config when reverting to the old one

When reloading, and the new config fails, deinit it before initializing
the old config. This is so that conflicting things do not remain held by
the half-initialized new config, while the old tries to take it
over. (It also removed a couple of memory leaks, most likely.)

The reason we can do this, is because cfg_tree_stop() (called by
cfg_deinit()) goes over all the known nodes, and log_pipe_deinit() is
also smart enough to not deinit a node that has not been inited before.

Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Merge pull request #41 from balabit/merge/f/cfg-tree/partial-deinit

cfg-tree tests & partial deinit on a reverting reload