you can initialize the raw pointer in the if else, then do:

scoped_ptr<mlab::ClientSocket> c_sock_scptr(c_sock);