This patient support community is for discussions relating to relationships, abstinence, arousal problems, birth control, cohabitation, commitment, communication, couples counseling, desire, sexual technique, and sexually transmitted diseases (STDs).
Try different positions when you masturbate and see if any particular one causes the leg pain. Then you'll know which one to avoid. I'd also recommend just stretching every once in a while, because it sounds like stiffness and cramping are resulting from when you masturbate. If you can, try to keep your leg relaxed while masturbating so that there is little risk of muscle tension in your leg. I think the best thing you can do for yourself is start stretching your legs and feet (even your foot muscles need to be massaged every once in a while) on a regular basis. You'd be surprised how stiff your muscles can get if you don't move much during the day. Good luck.