The Messenger of Allah (ﷺ) said: When any of you breaks wind during the prayer, he should turn away and perform ablution and repeat the prayer.
Sunan Abi Dawud Book 1, Hadith 205