Urwah bin al-Zubayr narrated from Hakim bin Hizam (may Allah be pleased with him), who said: I said: O Messenger of Allah! What do you think about the things I used to do in the Days of Ignorance for the sake of righteousness? The Messenger of Allah (peace and blessings be upon him) said: "You have embraced Islam along with the good deeds you did before." Hisham said: And he had freed slaves in the Days of Ignorance.
Hadith Referenceالمعجم الكبير للطبراني / باب الحاء / 3072