evas - evas_gl - fix shader patch to not free static strings

parsing problem with opengl_strtok() which would free the previous
token "p", but in some cases it would be a const string. this should
fix CID 1039653
This commit is contained in:
Carsten Haitzler 2013-12-11 22:40:15 +09:00
parent f0ba71314e
commit f3d1db0fba
2 changed files with 12 additions and 6 deletions

View File

@ -2120,15 +2120,18 @@ do_eglShaderPatch(const char *source, int length, int *patched_len)
{
if (!strncmp(p, "gl_MaxVertexUniformVectors", 26))
{
p = "(gl_MaxVertexUniformComponents / 4)";
free(p);
p = strdup("(gl_MaxVertexUniformComponents / 4)");
}
else if (!strncmp(p, "gl_MaxFragmentUniformVectors", 28))
{
p = "(gl_MaxFragmentUniformComponents / 4)";
free(p);
p = strdup("(gl_MaxFragmentUniformComponents / 4)");
}
else if (!strncmp(p, "gl_MaxVaryingVectors", 20))
{
p = "(gl_MaxVaryingFloats / 4)";
free(p);
p = strdup("(gl_MaxVaryingFloats / 4)");
}
int new_len = strlen(p);

View File

@ -3330,15 +3330,18 @@ patch_gles_shader(const char *source, int length, int *patched_len)
{
if (!strncmp(p, "gl_MaxVertexUniformVectors", 26))
{
p = "(gl_MaxVertexUniformComponents / 4)";
free(p);
p = strdup("(gl_MaxVertexUniformComponents / 4)");
}
else if (!strncmp(p, "gl_MaxFragmentUniformVectors", 28))
{
p = "(gl_MaxFragmentUniformComponents / 4)";
free(p);
p = strdup("(gl_MaxFragmentUniformComponents / 4)");
}
else if (!strncmp(p, "gl_MaxVaryingVectors", 20))
{
p = "(gl_MaxVaryingFloats / 4)";
free(p);
p = strdup("(gl_MaxVaryingFloats / 4)");
}
int new_len = strlen(p);