Sahih Muslim 3291
The Book of Pilgrimage
حَدَّثَنَا يَحْيَى بْنُ يَحْيَى، وَزُهَيْرُ بْنُ حَرْبٍ، قَالَ يَحْيَى أَخْبَرَنَا وَقَالَ، زُهَيْرٌ حَدَّثَنَا جَرِيرٌ، عَنْ مَنْصُورٍ، عَنْ أَبِي حَازِمٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " مَنْ أَتَى هَذَا الْبَيْتَ فَلَمْ يَرْفُثْ وَلَمْ يَفْسُقْ رَجَعَ كَمَا وَلَدَتْهُ أُمُّهُ " .
Abu Huraira (Allah be pleased with him) reported Allah's Messenger (ﷺ) as saying:He who came to this House (Ka'ba) (with the intention of performing Pilgrimage), and neither spoke indecently nor did he act wickedly. would return (free from sin) as on the (very first day) his mother bore him
Text from the public-domain hadith-api dataset. Numbering follows that dataset and can differ by a few from some printed editions — check the wording, not only the number.