Fix error handling in temp register allocation