Muwatta Malik, Book 1, Hadith 31 (In-Book)

Yahya related to me from Malik from Ibn Shihab from Said ibn al- Musayyab that the Messenger of Allah, may Allah bless him and grant him peace, said, "Anyone who eats this plant should not come near our mosques. The smell of the garlic will offend us."

حَدَّثَنِي يَحْيَى، عَنْ مَالِكٍ، عَنِ ابْنِ شِهَابٍ، عَنْ سَعِيدِ بْنِ الْمُسَيَّبِ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏ "‏ مَنْ أَكَلَ مِنْ هَذِهِ الشَّجَرَةِ فَلاَ يَقْرُبْ مَسَاجِدَنَا يُؤْذِينَا بِرِيحِ الثُّومِ ‏" ‏ ‏.‏

sunnah.com

also referenced under: Book 1, Hadith 30 (USC-MSA)