It is narrated from Sayyiduna Abu Hurairah (may Allah be pleased with him), he says that the Messenger of Allah (peace and blessings of Allah be upon him) said: "When any one of you feels something in his stomach and becomes doubtful whether anything has come out of his stomach or not, then he should not leave (the mosque) until he hears a sound or perceives a smell."
Related hadith on this topic