I freed forty slaves during the days of ignorance.The Messenger of Allah ﷺ said, "You embraced Islam along with all the good deeds you had done before."
قال قرئ على سفيان سمعت هشاما عن أبيه
أعتقت في الجاهلية أربعين محررا فقال رسول الله ﷺ أسلمت على ما سبق لك من خير
No references are available.
Its isnad is sahih. Hisham is Ibn Urwa bin Zubayr, who narrates from his father, and both are imams. The hadith has already appeared at 15200.