Fiqh-us-Sunnah Volume 1, Purification and Prayer, Fiqh 1.039.

Section : Of doubts whether or not one has released gas.

This is the case where the person cannot quite recall if he is in a state of purity or not. Such a state of mind does not nullify ablution, regardless of whether the person is in prayer or not, until he is certain that he has nullified his ablution. ‘Abbad ibn Tameem related that his uncle queried the Prophet about a person who feels something in his abdomen while praying. Said the Prophet, “He should not leave (the prayer) until he hears it or smells it.” (Related by Muslim, Abu Dawud and at-Tirmizhi). It does not mean that its sound or bad smell nullifies ablution, but that the person must be certain about the fact that he has nullified his ablution. Says Ibn al-Mubarak, “If one is uncertain about his condition of purity, he does not need to perform a new ablution.” If one is certain that he has nullified his ablution and doubts whether he has purified himself or not, he must perform a new ablution.