It is narrated from Abdullah bin Shaddad that the daughter of Sayyiduna Hamza (may Allah be pleased with him) freed her slave. That slave passed away, leaving behind his daughter and his mistress, the daughter of Hamza. So the Messenger of Allah (peace and blessings be upon him) divided his inheritance equally, half to his daughter and half to his mistress.
Brief Explanation
(Commentary on Hadiths 3043 to 3046)
From this it is understood that whatever remains from the heirs of a freed slave or slave-girl, its inheritor will be the master (male or female) who set them free.
The one who set them free (male or female) will be entitled to inherit the entire wealth only when there is no other real heir present.
And Allah knows best.