أَخْبَرَنَا أَحْمَدُ بْنُ حَفْصٍ، قَالَ حَدَّثَنِي أَبِي قَالَ، حَدَّثَنِي إِبْرَاهِيمُ بْنُ طَهْمَانَ، عَنْ يَحْيَى بْنِ سَعِيدٍ، عَنْ حُمَيْدٍ الطَّوِيلِ، عَنْ أَنَسِ بْنِ مَالِكٍ، قَالَ أَتَى رَسُولُ اللَّهِ صلى الله عليه وسلم عَلَى رَجُلٍ يُهَادَى بَيْنَ ابْنَيْهِ فَقَالَ ‏"‏ مَا شَأْنُ هَذَا ‏"‏ ‏.‏ فَقِيلَ نَذَرَ أَنْ يَمْشِيَ إِلَى الْكَعْبَةِ ‏.‏ فَقَالَ ‏"‏ إِنَّ اللَّهَ لاَ يَصْنَعُ بِتَعْذِيبِ هَذَا نَفْسَهُ شَيْئًا ‏"‏ ‏.‏ فَأَمَرَهُ أَنْ يَرْكَبَ ‏.‏

It was narrated that Anas bin Malik said: "The Messenger of Allah came to a man who was being supported by two others and said: 'What is the matter with him?' It was said: 'He vowed to walk to the Ka'bah.' He said: 'Allah does not benefit from his torturing himself.' And he told him to ride." Translation Not Available

Book Ref: Sunan An Nisai Book 35 Hadith 3854
Web Ref:  Sunan An Nisai Vol 4 Book 35 Hadith 3885