client: Do not leak resources on connection failure

When connecting to riemann fails, correctly free up the allocated
resources on the error branches.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>