Hakim bin Hizam (may Allah be pleased with him) said: I said: O Messenger of Allah! In the Days of Ignorance I freed forty slaves. He (peace and blessings be upon him) said: "You have embraced Islam along with the good deeds you did before."
Hadith Referenceالمعجم الكبير للطبراني / باب الحاء / 3063