Fix for memory leak in WebGL

CRs-fixed: 407009

(cherry-picked from commit 796a2a4cc637a3b04ee845e595b081e826207924)

Change-Id: I584fe07dd5887ed52b74bc84044d510f8a2e2ba8