Shader: Fix memory leaks