The Messenger of Allah ﷺ said, "Whoever frees a slave jointly owned by himself and another, the slave shall be valued at a fair price, neither reduced nor inflated. Then, if he has the means, the rest of the slave shall be freed from his wealth."
أن رسول الله ﷺ قال: من أعتق عبدا بينه وبين آخر قوم عليه في ماله قيمة عدل، لا وكس، ولا شطط، ثم عتق عليه في ماله إن كان موسرا.
Bukhari narrated it in the Book of Manumission (2521), and Muslim in the Book of Oaths and Vows (1501:50), both of them via Sufyan bin Uyayna, from Amr (that is, Ibn Dinar), from Salim, from his father, who mentioned it. The wording given is that of Muslim.