Fix memory leak converting image in RAM to GL texture.