It is narrated from Mughirah bin Shu'bah (may Allah be pleased with him); he said: I prayed beside the Prophet (peace and blessings be upon him), and he (peace and blessings be upon him) noticed the smell of garlic on me. He (peace and blessings be upon him) said: "What is this smell?" I said: O Messenger of Allah! I had pain in my chest, so I ate (garlic as a remedy). The Prophet (peace and blessings be upon him) did not reproach me for it.
Hadith Referenceالمعجم الكبير للطبراني / باب الميم / 18172