- remove unreachable code
- fix resource leaks