Sayyiduna Abu Umamah (may Allah be pleased with him) narrated: I was sitting with the Prophet (peace and blessings be upon him) when a man came and said: O Messenger of Allah, I have committed a hadd (offence), so carry it out upon me. The Prophet (peace and blessings be upon him) remained silent. He repeated it and said: I have committed a hadd (offence), so carry it out upon me. (The narrator) said: Meanwhile the prayer was called to begin; the Messenger of Allah (peace and blessings be upon him) entered (the mosque) and (after the prayer) came out. Shaddad (may Allah have mercy on him) said: Then Sayyiduna Abu Umamah (may Allah be pleased with him) narrated to me: I was walking with the Messenger of Allah (peace and blessings be upon him), and the man was following him (peace and blessings be upon him), saying: O Messenger of Allah, I have committed a hadd (offence), so carry it out upon me. The Messenger of Allah (peace and blessings be upon him) asked: "When you left your house, did you perform ablution well?" He said: Yes. He (peace and blessings be upon him) asked: "And did you attend the prayer with us?" He said: Yes. He (peace and blessings be upon him) said: "Then indeed Allah, the Mighty and Majestic, has forgiven your hadd (sin), or he said: your debt."
Hadith Referenceالمعجم الكبير للطبراني / باب الصاد / 7593