Sahih Muslim Book 9, Hadith Number 3589.

Chapter: The right of inheritance of property vests with one who emancipates the slave.

‘Abd al-Rahman b. al-Qasim reported on the authority of his father: ‘Aisha (Allah be pleased with her) said: There were three issues which were clarified in case of Barira: her owners had decided to sell her on the condition that the right of her inheritance would vest with them. She (‘Aisha) said: I made a mention of that to Allah’s Apostle (may peace be upon him) and he said: Buy her and emancipate her, for verily the right of inheritance vests with one who emancipates. She said that she emancipated (her) and Allah’s Messenger (may peace be upon him) gave her the option (either to retain her matrimonial alliance or break it after emancipation). She (taking advantage of the option) opted for herself (the severing of matrimonial alliance). ‘Aisha said: The people used to give her charity and she gave us that as gift. I made a mention of it to Allah’s Apostle (may peace be upon him), whereupon he said: That is charity for her but gift for you, so take that.