‘Imran b. Husain said that the Prophet (ﷺ) led them in prayer and forgot something, so he made two prostrations, then uttered the shahada, then gave the salutation.
Tirmidhi transmitted it and said this is a hasan gharib…
Al-Mughira b. Shu'ba reported God’s Messenger as saying, “When an imam stands up at the end of two rak'as, if he remembers before standing straight up he should sit down, but if he stands straight up he must not sit down…