Ata bin Abi Rabah narrated from Jabir bin Abdullah (may Allah be pleased with them both) that a man made his slave free after his death, so the Messenger of Allah (peace and blessings be upon him) sold him and returned the price to the owner, and said: "You are more in need of it, and Allah is free of need of it."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب المدبر / 21549