Zuhri reported,

Abu Salama bin Abdul-Rahman reported that Abu Hurairah said, "Whenever a man who had died in debt was brought to the Messenger of Allah ﷺ, he would ask, 'Did he leave behind anything to settle his debt?' If he was told that the man had left enough to cover it, he would pray over him. Otherwise he would say, 'You pray over your companion.'Then, when Allah granted him victory after victory, he said, 'I am closer to the believers than they are to themselves. So whoever dies leaving a debt, I will settle it, and whoever leaves property, it belongs to his heirs.'"

Muslim 4158

Sahih

حدثنا عبد الملك بن شعيب بن الليث حدثني أبي عن جدي حدثني عقيل ح و حدثني زهير بن حرب حدثنا يعقوب بن إبراهيم حدثنا ابن أخي ابن شهاب ح و حدثنا ابن نمير حدثنا أبي حدثنا ابن أبي ذئب كلهم عن الزهري بهذا الإسناد هذا الحديث

مسلم 4158صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Obligatory duties
Chapter
Whoever leaves wealth, it is for his heirs
Numbering
Darussalam 4158
Muslim 4158