mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-08-06 10:44:01 +00:00
[client/common] fixes for issues detected through static analysis.
This commit is contained in:
@@ -793,7 +793,7 @@ static bool egl_renderStartup(LG_Renderer * renderer, bool useDMA)
|
||||
else if (debug)
|
||||
DEBUG_WARN("Cannot create debug contexts before EGL 1.5 without EGL_KHR_create_context");
|
||||
|
||||
ctxattr[ctxidx++] = EGL_NONE;
|
||||
ctxattr[ctxidx] = EGL_NONE;
|
||||
|
||||
this->context = eglCreateContext(this->display, this->configs, EGL_NO_CONTEXT, ctxattr);
|
||||
if (this->context == EGL_NO_CONTEXT)
|
||||
|
@@ -124,10 +124,31 @@ void egl_modelSetDefault(EGL_Model * model, bool flipped)
|
||||
void egl_modelAddVerts(EGL_Model * model, const GLfloat * verticies, const GLfloat * uvs, const size_t count)
|
||||
{
|
||||
struct FloatList * fl = malloc(sizeof(*fl));
|
||||
if (!fl)
|
||||
{
|
||||
DEBUG_ERROR("out of memory");
|
||||
return;
|
||||
}
|
||||
|
||||
fl->count = count;
|
||||
fl->v = malloc(sizeof(GLfloat) * count * 3);
|
||||
fl->u = malloc(sizeof(GLfloat) * count * 2);
|
||||
|
||||
fl->v = malloc(sizeof(GLfloat) * count * 3);
|
||||
if (!fl->v)
|
||||
{
|
||||
DEBUG_ERROR("out of memory");
|
||||
free(fl);
|
||||
return;
|
||||
}
|
||||
|
||||
fl->u = malloc(sizeof(GLfloat) * count * 2);
|
||||
if (!fl->u)
|
||||
{
|
||||
DEBUG_ERROR("out of memory");
|
||||
free(fl->v);
|
||||
free(fl);
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(fl->v, verticies, sizeof(GLfloat) * count * 3);
|
||||
|
||||
if (uvs)
|
||||
|
@@ -119,10 +119,15 @@ bool egl_shaderCompile(EGL_Shader * this, const char * vertex_code,
|
||||
if (logLength > 0)
|
||||
{
|
||||
char *log = malloc(logLength + 1);
|
||||
glGetShaderInfoLog(vertexShader, logLength, NULL, log);
|
||||
log[logLength] = 0;
|
||||
DEBUG_ERROR("%s", log);
|
||||
free(log);
|
||||
if (!log)
|
||||
DEBUG_ERROR("out of memory");
|
||||
else
|
||||
{
|
||||
glGetShaderInfoLog(vertexShader, logLength, NULL, log);
|
||||
log[logLength] = 0;
|
||||
DEBUG_ERROR("%s", log);
|
||||
free(log);
|
||||
}
|
||||
}
|
||||
|
||||
glDeleteShader(vertexShader);
|
||||
@@ -145,10 +150,15 @@ bool egl_shaderCompile(EGL_Shader * this, const char * vertex_code,
|
||||
if (logLength > 0)
|
||||
{
|
||||
char *log = malloc(logLength + 1);
|
||||
glGetShaderInfoLog(fragmentShader, logLength, NULL, log);
|
||||
log[logLength] = 0;
|
||||
DEBUG_ERROR("%s", log);
|
||||
free(log);
|
||||
if (!log)
|
||||
DEBUG_ERROR("out of memory");
|
||||
else
|
||||
{
|
||||
glGetShaderInfoLog(fragmentShader, logLength, NULL, log);
|
||||
log[logLength] = 0;
|
||||
DEBUG_ERROR("%s", log);
|
||||
free(log);
|
||||
}
|
||||
}
|
||||
|
||||
glDeleteShader(fragmentShader);
|
||||
@@ -201,6 +211,12 @@ void egl_shaderSetUniforms(EGL_Shader * this, EGL_Uniform * uniforms, int count)
|
||||
{
|
||||
free(this->uniforms);
|
||||
this->uniforms = malloc(sizeof(*this->uniforms) * count);
|
||||
if (!this->uniforms)
|
||||
{
|
||||
DEBUG_ERROR("out of memory");
|
||||
return;
|
||||
}
|
||||
|
||||
this->uniformCount = count;
|
||||
}
|
||||
|
||||
|
@@ -327,7 +327,14 @@ bool opengl_onMouseShape(LG_Renderer * renderer, const LG_RendererCursor cursor,
|
||||
{
|
||||
if (this->mouseData)
|
||||
free(this->mouseData);
|
||||
this->mouseData = malloc(size);
|
||||
|
||||
this->mouseData = malloc(size);
|
||||
if (!this->mouseData)
|
||||
{
|
||||
DEBUG_ERROR("out of memory");
|
||||
return false;
|
||||
}
|
||||
|
||||
this->mouseDataSize = size;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user