Fixed memory leaks in lib, wshc and wsh-add-hostkeys