Sunan an-Nasa'i, Book 35, Hadith 94 (In-Book)

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."

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

sunnah.com