smtp: don't read uninitialized value

If a reply would be seen before a command, a read of a uninitialized
value could happen.

This patch adds a check for this.

Bug #1089.
tls: fix uninitialized var use

errcode wasn't initialized and in some code paths it remained
uninitialized, leading to us evaluating this uninitialized value.

Bug #1091
ftp: fix memory leak

db pointers in both directions were not freed. This patch frees them
in the state free function.

Bug #1090