It is narrated from Sayyiduna Imran bin Husayn (may Allah be pleased with him) that a man freed six slaves, then his heirs came and found nothing, so they came to the Messenger of Allah (peace and blessings be upon him) and informed him (peace and blessings be upon him). He (peace and blessings be upon him) said: "Had I known this, then, if Allah willed, I would not have led his funeral prayer." Then he (peace and blessings be upon him) cast lots between them, freed two and made four slaves.
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 15495