Leg cramps occur for many reasons, but most the common cause is dehydration. In any case, here are two easy stretches for your upper leg from MedlinePlus.gov.
Quadricep Stretch
The quadricep is the front thigh muscle. To alleviate a cramp rub the muscle to relax it. Hold onto support while standing, lift your foot and bend the knee of the affected leg. Grasp your foot with your hand from behind. Gently pull it backward and up, and try to touch it to your buttock. Stop pulling if you experience discomfort or pain. Hold your foot in that position for 10 to 20 seconds. Release it and lower your foot to the ground slowly. more at medlineplus.gov
Hamstring Stretch
To relieve a back thigh cramp, massage the muscle, the sit with both legs stretched out in front. Grab your foot with your hand and gently pull it toward your head. Keep your knee straight as you slowly lift the leg as high as you can without pain. Hold for a count of 10 to 20. Release your foot and lower it slowly. You should feel the muscle relax. more at medlineplus.gov
When to Seek Help
If you continue to experience pain and cramping frequently and severely, and it does not respond to your self-care efforts, Active Release Technique and Graston Technique can help. Read more about these successful alternative therapies that many pro athletes use to treat and prevent injury.