Muwatta Malik, Book 9, Hadith 80 (USC-MSA) ⓘ
Yahya related to me from Malik from Nafi that Abdullah ibn Umar used to say, "Someone who only remembers that he has forgotten a prayer when he is praying the next prayer behind an imam, should pray the prayer he has forgotten after the imam has said the taslim, and then pray the other one again."
وَحَدَّثَنِي عَنْ مَالِكٍ، عَنْ نَافِعٍ، أَنَّ عَبْدَ اللَّهِ بْنَ عُمَرَ، كَانَ يَقُولُ مَنْ نَسِيَ صَلاَةً فَلَمْ يَذْكُرْهَا إِلاَّ وَهُوَ مَعَ الإِمَامِ فَإِذَا سَلَّمَ الإِمَامُ فَلْيُصَلِّ الصَّلاَةَ الَّتِي نَسِيَ ثُمَّ لِيُصَلِّ بَعْدَهَا الأُخْرَى .
also referenced under: Book 9, Hadith 411 (In-Book)