It was narrated from Samurah bin Jundub that the Prophet (ﷺ) said:
"Whoever becomes the master of a Mahram relative (with whom marriage is not lawful), he becomes free." (JA)
English reference (JA): Vol. 3, Book 19, Hadith 2524 (JA)
Arabic reference (JA): Book 19, Hadith 2620 (JA)