Ugh, leg cramps are a pain in more ways than one! I'll grab the tip of my fin and pull back to stretch out the calf muscle for a minute and that usually takes care of it. And back on the surface, I'll drink a lot of water to rehydrate, since dehydration is often a factor with cramps.
Also, some people swear by mustard as a home remedy for relieving cramps, so I always carry some turmeric capsules in my dive bag. Turmeric is the active ingredient in mustard if, like me, you don't like the taste of mustard itself.