fix resource leak, performance issue, alternative route success rate. coverity issue 971431