Sahih Muslim Book 11, Hadith Number 3944.

Chapter : He who leaves behind property, that is for the heirs.

Abu Huraira (Allah be pleased with him) reported that when the body of a dead person having burden of debt upon him was brought to Allah’s Messenger(may peace be upon him) he would ask whether he had left property enough to clear off his debt, and if the property left had been sufficient for that (purpose), he observed funeral prayer for him, otherwise he said (to his companions): You observe prayer for your companion. But when Allah opened the gateways of victory for him, he said: I am nearer to the believers than themselves, so if anyone dies leaving a debt, its payment is my responsibility, and if anyone leaves a property, it goes to his heirs.