mirror of https://github.com/mgba-emu/mgba.git
OpenGL: Fix null calloc/memcpy
This commit is contained in:
parent
5558e469e0
commit
8c5ad62dbc
|
@ -1010,8 +1010,11 @@ bool mGLES2ShaderLoad(struct VideoShader* shader, struct VDir* dir) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
u = mGLES2UniformListSize(&uniformVector);
|
u = mGLES2UniformListSize(&uniformVector);
|
||||||
struct mGLES2Uniform* uniformBlock = calloc(u, sizeof(*uniformBlock));
|
struct mGLES2Uniform* uniformBlock;
|
||||||
memcpy(uniformBlock, mGLES2UniformListGetPointer(&uniformVector, 0), sizeof(*uniformBlock) * u);
|
if (u) {
|
||||||
|
uniformBlock = calloc(u, sizeof(*uniformBlock));
|
||||||
|
memcpy(uniformBlock, mGLES2UniformListGetPointer(&uniformVector, 0), sizeof(*uniformBlock) * u);
|
||||||
|
}
|
||||||
mGLES2UniformListDeinit(&uniformVector);
|
mGLES2UniformListDeinit(&uniformVector);
|
||||||
|
|
||||||
mGLES2ShaderInit(&shaderBlock[n], vssrc, fssrc, width, height, scaling, uniformBlock, u);
|
mGLES2ShaderInit(&shaderBlock[n], vssrc, fssrc, width, height, scaling, uniformBlock, u);
|
||||||
|
|
Loading…
Reference in New Issue