A man died leaving no heir but a slave whom he had emancipated. The Messenger of Allah ﷺ asked: Has he any heir? They replied: No, except a slave whom he had emancipated. The Messenger of Allah ﷺ assigned his estate to him (the emancipated slave).
أَنَّ رَجُلاً مَاتَ وَلَمْ يَدَعْ وَارِثًا إِلاَّ غُلاَمًا لَهُ كَانَ أَعْتَقَهُ فَقَالَ رَسُولُ اللَّهِ ﷺ هَلْ لَهُ أَحَدٌ قَالُوا لاَ إِلاَّ غُلاَمًا لَهُ كَانَ أَعْتَقَهُ فَجَعَلَ رَسُولُ اللَّهِ ﷺ مِيرَاثَهُ لَهُ