I have been tackling with masturbation and porn addiction for years.
What has worked for me was meditating,drawing, painting and going for walks when ever I felt the need to masturbate.
Those methods worked for me because I used to masturbate when ever I was bored or felt lonely.
If those methods don't work for you then I guess you have to see a doctor about it,
don't be embarrassed about it 
everyone has problems sometimes.