Fix an incorrect type cast.
Merge pull request #798 from pengx17:master_ocl_mleak