Fix segfault on malloc failure
Make message destruction use destructor
Fix connection socket leaking

Add connection destructor