I heard the Messenger of Allah ﷺ say, "Whenever a slave is jointly owned by two partners and one of them frees his share, the slave is to be valued at a fair price against the wealth of the one who freed him. If his wealth is sufficient to cover that price, the slave is set free."
حدثنا هاشم حدثنا ليث عن نافع
سمعت رسول الله ﷺ يقول أيما مملوك كان بين شريكين فأعتق أحدهما نصيبه فإنه يقام في مال الذي أعتق قيمة عدل فيعتق إن بلغ ذلك ماله
Its isnad is sahih. Hashim is Ibn Qasim Abu Nadr. The hadith is an abridgment of 5920.