Socket refactoring: Removed possible NULL dereference; removed redundant check in listen