Sahih al-Bukhari, Volume 9, Book 93, Hadith 597 (USC-MSA)

Narrated Abu Huraira: Allah's Messenger said, "A man who never did any good deed, said that if he died, his family should burn him and throw half the ashes of his burnt body in the earth and the other half in the sea, for by Allah, if Allah should get hold of him, He would inflict such punishment on him as He would not inflict on anybody among the people. But Allah ordered the sea to collect what was in it (of his ashes) and similarly ordered the earth to collect what was in it (of his ashes). Then Allah said (to the recreated man ), 'Why did you do so?' The man replied, 'For being afraid of You, and You know it (very well).' So Allah forgave him."

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

sunnah.com