Sahih Bukhari Volume 007, Book 064, Hadith Number 284.

Narrated By Abu Huraira : A dead man in debt used to be brought to Allah's Apostle who would ask, "Has he left anything to re pay his debts?" If he was informed that he had left something to cover his debts the Prophet would offer the funeral prayer for him; otherwise he would say to the Muslims present there), "Offer the funeral prayer for your friend:"but when Allah helped the Prophet to gain victory (on his expeditions), he said, "I am closer to the Believers than themselves, so. if one of the Believers dies in debt, I will repay it, but if he leaves wealth, it will be for his heirs.