Qatadah reported Umar ibn al-Khattab (may Allah be pleased with him) as saying: If anyone gets possession of a relative who is within the prohibited degrees, that person becomes free. (Using translation from Abū Dāʾūd 3950)
أَنَّ النَّبِيَّ ﷺ قَالَ «مَنْ مَلَكَ ذَا مَحْرَمٍ فَهُوَ حُرٌّ»