Muwatta Malik, Book 20, Hadith 868 (In-Book)

Yahya related to me from Malik that he had heard Rabia ibn Abi Abd ar-Rahman saying the same about that as what Ikrama related from Ibn Abbas. Malik said, "That is what I like most out of what I have heard about the matter." Malik was asked about a man who forgot the tawaf al-ifada until he had left Makka and returned to his community and he said, "I think that he should go back and do the tawaf al-ifada, as long as he has not had sexual relations with women. If, however, he has had sexual relations with women, then he should not only return and do the tawaf al-ifada, but he should also do an umra and sacrifice an animal. He should not buy theanimal in Makka and sacrifice it there, but if he has not brought one with him from wherever it was he set out to do umra, he should buy one in Makka and then take it outside the limits of the Haram and drive it from there to Makka and sacrifice it there."

وَحَدَّثَنِي عَنْ مَالِكٍ، أَنَّهُ سَمِعَ رَبِيعَةَ بْنَ أَبِي عَبْدِ الرَّحْمَنِ، يَقُولُ فِي ذَلِكَ مِثْلَ قَوْلِ عِكْرِمَةَ عَنِ ابْنِ عَبَّاسٍ ‏.‏ قَالَ مَالِكٌ وَذَلِكَ أَحَبُّ مَا سَمِعْتُ إِلَىَّ فِي ذَلِكَ ‏.‏ وَسُئِلَ مَالِكٌ عَنْ رَجُلٍ نَسِيَ الإِفَاضَةَ حَتَّى خَرَجَ مِنْ مَكَّةَ وَرَجَعَ إِلَى بِلاَدِهِ فَقَالَ أَرَى إِنْ لَمْ يَكُنْ أَصَابَ النِّسَاءَ فَلْيَرْجِعْ فَلْيُفِضْ وَإِنْ كَانَ أَصَابَ النِّسَاءَ فَلْيَرْجِعْ فَلْيُفِضْ ثُمَّ لِيَعْتَمِرْ وَلْيُهْدِ وَلاَ يَنْبَغِي لَهُ أَنْ يَشْتَرِيَ هَدْيَهُ مِنْ مَكَّةَ وَيَنْحَرَهُ بِهَا وَلَكِنْ إِنْ لَمْ يَكُنْ سَاقَهُ مَعَهُ مِنْ حَيْثُ اعْتَمَرَ فَلْيَشْتَرِهِ بِمَكَّةَ ثُمَّ لِيُخْرِجْهُ إِلَى الْحِلِّ فَلْيَسُقْهُ مِنْهُ إِلَى مَكَّةَ ثُمَّ يَنْحَرُهُ بِهَا ‏.‏

sunnah.com

also referenced under: Book 20, Hadith 166 (USC-MSA)