Fix memory leak. Pass retry count to subrequests