Sunan Abi Dawud, Book 29, Hadith 3952 (USC-MSA)

Narrated AbuHurayrah: The Prophet said: The child of adultery is worst of the three. Abu Hurairah said: That I give a flog in the path of Allah (as a charity) is dearer to me than emancipating a child of adultery.

حَدَّثَنَا إِبْرَاهِيمُ بْنُ مُوسَى، أَخْبَرَنَا جَرِيرٌ، عَنْ سُهَيْلِ بْنِ أَبِي صَالِحٍ، عَنْ أَبِيهِ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ وَلَدُ الزِّنَا شَرُّ الثَّلاَثَةِ ‏" ‏ ‏.‏ وَقَالَ أَبُو هُرَيْرَةَ لأَنْ أُمَتِّعَ بِسَوْطٍ فِي سَبِيلِ اللَّهِ عَزَّ وَجَلَّ أَحَبُّ إِلَىَّ مِنْ أَنْ أَعْتِقَ وَلَدَ زِنْيَةٍ ‏.‏

sunnah.com