كتاب قصر الصلاة فى السفر
9  
Shortening the Prayer

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."

وَحَدَّثَنِي عَنْ مَالِكٍ، عَنْ نَافِعٍ، أَنَّ عَبْدَ اللَّهِ بْنَ عُمَرَ، كَانَ يَقُولُ مَنْ نَسِيَ صَلاَةً فَلَمْ يَذْكُرْهَا إِلاَّ وَهُوَ مَعَ الإِمَامِ فَإِذَا سَلَّمَ الإِمَامُ فَلْيُصَلِّ الصَّلاَةَ الَّتِي نَسِيَ ثُمَّ لِيُصَلِّ بَعْدَهَا الأُخْرَى ‏.‏
USC-MSA web (English) reference : Book 9, Hadith 80
Arabic reference : Book 9, Hadith 411