Sayyidah.Abu Hurayrah (RA) narrated : If a debtor’s body was brought to Allah’s Messenger (SAW) for the funeral salah, he would ask, “Has he left anything to repay debts?” If he was told that he had left enough to pay off his debts then he would lead his funeral salah, otherwise he would ask the Muslims to pray over their companion. When Allah opened for him (a number of) victories, he stood up and said, “I am better for the Believers than their own selves. Hence, if any of the Believers dies leaving a debt then his debt is on me, and if he leaves behind property then that belongs to the heirs.”
[Ahmed9855, Bukhari 2298, Muslim 1619, Nisai 1963]
--------------------------------------------------------------------------------