I just had my second surgery in the last 3 years to correct this "Trigger Finger" problem. Cortisone shots are the first treatment, and sometimes they can fix it.
After 2 shots, surgery is most likely the only option other than living with it.
Inflammation due to Rheumatoid Arthritis has added to my problem. I tried to ignore the locking but every night I would awaken to find my ring finger planted in my palm. Very painful to undo.