From Sahih Muslim (Hadith 4327):
Abdullah b. 'Umar reported Allah's Messenger (ﷺ) as saying:He who gives up his share in a slave, and he has money enough to meet the full price, a fair price for him should be fixed; otherwise be has emancipated him to the extent that he has emancipated
Reference: Muslim 4327