Prayer (Kitab Al-Salat): Details of Commencing Prayer
Dawud :: Book 3 : Hadith 1031
Narrated Al-Mughirah ibn Shu'bah:
The Prophet (peace_be_upon_him) said: When an imam stands up at the end of two rak'ahs , if he remembers before standing straight up, he should sit down, but if he stands straight up, he must not sit down, but perform the two prostrations of forgetfulness.