The Messenger of Allah ﷺ said, "Whoever frees his share in a jointly-owned slave must have a fair price set for the slave, then pay his partners their shares so the slave is fully freed by him. Otherwise, only the portion he owned is freed."
حدثنا القعنبي عن مالك عن نافع
أن رسول الله ﷺ قال من أعتق شركا له في مملوك أقيم عليه قيمة العدل فأعطى شركاءه حصصهم وأعتق عليه العبد وإلا فقد عتق منه ما عتق
Bukhari narrated it in the Book of Manumission, Chapter "If someone frees his share of a slave, male or female, owned jointly with partners," hadith no. 2522, and Muslim in the Book of Manumission, Chapter "One who frees his share in a slave," hadith no. 1501, both from the hadith of Malik through this same chain, and it is also found in Muwatta (Yahya's recension), 2/772.