The money left by a dead person is to be used, first of all, for settling his debts then in executing his Shar`y (Islamic legal) will if any, and the remainder is to be divided among heirs.
If all heirs approve of
dedicating the estate to charitable purposes or giving it in charity to the poor, for example, it will be unobjectionable and they will even be rewarded for it.
Money he would receive from social insurance and annual gifts is to be known about from the authority that would pay him. May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.