Fix memory leak on ESI