Mughirah (may Allah have mercy on him) narrates from his companions that Sayyiduna Zayd (may Allah be pleased with him), when he did not find anyone from the 'asabah (agnatic heirs), would not return (the surplus) to any sharer, but would return it to the mawlas; and if there were no mawlas, he would put it into the public treasury (bayt al-mal).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الفرائض / 12388