It is narrated from Ibn Umar (may Allah be pleased with them both) from Aisha (may Allah be pleased with her) that she intended to buy a slave girl in order to set her free. The owner said: "We sell her to you on the condition that her wala' (right of inheritance/loyalty) will be attributed to us." When Aisha (may Allah be pleased with her) mentioned this to the Messenger of Allah (peace and blessings be upon him), he said: "Do not let this prevent you (from setting her free), and indeed, wala' belongs to the one who sets free."
Hadith Referenceمسند الإمام الشافعي / كتاب العتق والولاء والمدبر والمكاتب وحسن الملكة / 1080