Sahih Muslim #3776 · The Book of Emancipating Slaves

Sahih MuslimIbn Umar reported that 'A'isha decided to buy a slave-girl and then set her free
Sahih Muslim · Book 20 · The Book of Emancipating Slaves
Sahih Muslim · كتاب 20 · كتاب العتق
We are prepared to sell her to you on the condition that her right of inheritance would vest with you. She (Hadrat A'isha) made a mention of that to Allah's Messenger (ﷺ) whereupon he said: This should not stand in your way. The right of inheritance vests in one who emancipates.
وَحَدَّثَنَا يَحْيَى بْنُ يَحْيَى، قَالَ قَرَأْتُ عَلَى مَالِكٍ عَنْ نَافِعٍ، عَنِ ابْنِ عُمَرَ، عَنْ عَائِشَةَ، أَنَّهَا أَرَادَتْ أَنْ تَشْتَرِيَ، جَارِيَةً تُعْتِقُهَا فَقَالَ أَهْلُهَا نَبِيعُكِهَا عَلَى أَنَّ وَلاَءَهَا لَنَا ‏.‏ فَذَكَرَتْ ذَلِكَ لِرَسُولِ اللَّهِ صلى الله عليه وسلم فَقَالَ ‏
"‏ لاَ يَمْنَعُكِ ذَلِكَ فَإِنَّمَا الْوَلاَءُ لِمَنْ أَعْتَقَ ‏"‏‏.‏
Reference : Sahih Muslim 3776In-book reference : Book 20, Hadith 7