Fixed unsafe code in connection.cpp
Fixed memory leak in Updater class and added additional  checks