fix memory leak for GLProgramState create logic
Merge pull request #6781 from dabingnn/v3_work

V3 work