Once a Muslim died in Madina. The Holy Prophet along with Ali attended the funeral. Before leading the funeral prayer, the Holy Prophet inquired whether the deceased had to pay any debt. He was told that the deceased had to pay a debt of a few dinars. The Holy Prophet desired that someone should undertake responsibility for clearing the debt of the deceased. It was Ali who undertook the responsibility for meeting the debt, and it was only then that the Holy Prophet led the funeral prayers.
"When a person dies, his works end, except for three: ongoing charity, knowledge that is benefited from, and a righteous child who prays for him."
Prophet Mohammed (PBUH)
"The best of what a man leaves behind are three: a righteous child who supplicates for him, ongoing charity the reward of which reaches him, and knowledge that is acted upon after him."
Sunan Ibn Mājah
"Every day two angels come down from Heaven and one of them says, 'O Allah! Compensate every person who spends in Your Cause,' and the other (angel) says, 'O Allah! Destroy every miser.'"
Sahih Bukhari