Masturbation and Pornography

Masturbation

Q: Scholars who don't allow masturbation as adopting lesser of the two evils like to avoid zina when there is real fear, do these scholars consider masturbation and zina equal in sin, when only done to avoid zina. What's their stance like many Maliki scholars and Shafi?