HADOOP-11321: Prevent possible memory leak in error handling.