Fixed a memory issue with retrieving socket options