Fixing resource leaks in src/net found via Coverity static analysis.