OpenGL: Fix null calloc/memcpy

This commit is contained in:
Vicki Pfau 2023-02-11 21:08:31 -08:00
parent 1722fe4530
commit 30fa0a3843
1 changed files with 5 additions and 2 deletions

View File

@ -1010,8 +1010,11 @@ bool mGLES2ShaderLoad(struct VideoShader* shader, struct VDir* dir) {
}
}
u = mGLES2UniformListSize(&uniformVector);
struct mGLES2Uniform* uniformBlock = calloc(u, sizeof(*uniformBlock));
struct mGLES2Uniform* uniformBlock;
if (u) {
uniformBlock = calloc(u, sizeof(*uniformBlock));
memcpy(uniformBlock, mGLES2UniformListGetPointer(&uniformVector, 0), sizeof(*uniformBlock) * u);
}
mGLES2UniformListDeinit(&uniformVector);
mGLES2ShaderInit(&shaderBlock[n], vssrc, fssrc, width, height, scaling, uniformBlock, u);