fix memory leak of bad net connection