It is narrated from Sayyiduna Imran bin Husayn (may Allah be pleased with him) that a man freed six slaves at the time of his death. His heirs came and informed the Prophet (peace and blessings be upon him) of what he had done. He (peace and blessings be upon him) said: "Had we known this, we would not have offered his funeral prayer." The Messenger of Allah (peace and blessings be upon him) cast lots among them, freed two and kept four in slavery.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الوصايا / 12550