It is narrated from Sayyiduna Salamah bin al-Akwa' (may Allah be pleased with him) that the funeral of a man from the Ansar was brought to the Messenger of Allah (peace and blessings be upon him) so that he would lead the funeral prayer over him. He (peace and blessings be upon him) asked: "He is not in debt, is he?" They said: No. He (peace and blessings be upon him) asked: "Has he left anything behind?" They said: Yes. So he (peace and blessings be upon him) led the funeral prayer over him. Then another funeral was brought. He (peace and blessings be upon him) asked: "Is he in debt?" They said: Yes. He (peace and blessings be upon him) asked: "Has he left anything behind?" They said: Yes. So he (peace and blessings be upon him) led the funeral prayer over him. Then another funeral was brought. He (peace and blessings be upon him) asked: "Is he in debt?" They answered yes. He (peace and blessings be upon him) asked: "Has he left anything behind?" They said: No. He (peace and blessings be upon him) said: "Offer the funeral prayer over your brother." Sayyiduna Abu Qatadah (may Allah be pleased with him) said: O Messenger of Allah, his debt is upon me. Then he (peace and blessings be upon him) led the funeral prayer over him.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الحوالة / 11395