(a) It is narrated from Sayyiduna Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "When one of you feels wind in his stomach and is unsure whether it has come out or not, he should not leave until he hears its sound or finds a smell."
(b) Suhayl bin Abi Salih says: He should not leave the mosque.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الطهارة / 750