Sahih al-Bukhari, Book 49, Hadith 5 (Bukhari 2421)

Narrated Ibn `Umar:

The Prophet (ﷺ) said, "Whoever manumits a slave owned by two masters, should manumit him completely (not partially) if he is rich after having its price evaluated."