Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) was asked about khadkhadah (self-stimulation), and he said: Marrying a slave woman is better than it, and it is better than fornication (zina).
This is mursal and mawquf.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب النكاح / 14132