Huzaifa bin Yaman reported,

I heard the Prophet ﷺ say, "A man was on the verge of death, and when he despaired of life, he instructed his family, 'When I die, gather a great deal of firewood for me, then kindle a fire until it consumes my flesh and reaches my bones. Then take my bones, grind them up, and scatter me in the sea on a hot or windy day.' So Allah gathered him together and asked him, 'Why did you do this?'He replied, 'Out of fear of You.'So Allah forgave him."

Azami 11418

Sahih

عن حذيفة قال

سمعت النبي ﷺ يقول: إن رجلا حضره الموت، لما أيس من الحياة أوصى أهله، إذا مت فاجمعوا لي حطبا كثيرا، ثم أوروا نارا، حتى إذا أكلت لحمي وخلصت إلى عظمي فخذوها فاطحنوها، فذروني في اليم في يوم حار أو راح، فجمعه الله فقال: لم فعلت؟ قال: خشيتك فغفر له.

الأعظمي 11418صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Repentance and seeking forgiveness
Chapter
Comprehensive and general supplications
Section
Regarding one who feared Allah's punishment and ordered his body burned after death, not knowing that Allah is Forgiving and Merciful
Numbering
Jami al-Kamil 11418 (2nd edition)
Azami 11418