summaryrefslogtreecommitdiffhomepage
path: root/src/rlgl.h
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2021-02-02 12:33:01 +0100
committerraysan5 <[email protected]>2021-02-02 12:33:01 +0100
commit005bc4c4143f2b79ffc18fa98be144c905d2ce7f (patch)
tree8df211f8d3e1372ca937c1f8cc6d5be9701b63e4 /src/rlgl.h
parented9c10a3e63e6a3eae669bf3155b3bf5d2cd3aa8 (diff)
downloadraylib-005bc4c4143f2b79ffc18fa98be144c905d2ce7f.tar.gz
raylib-005bc4c4143f2b79ffc18fa98be144c905d2ce7f.zip
REVIEWED: LoadShaderProgram() #1563
Try to avoid a possible false-positive memory leak...
Diffstat (limited to 'src/rlgl.h')
-rw-r--r--src/rlgl.h24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/rlgl.h b/src/rlgl.h
index 11f511cc..3eec9e16 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -3639,7 +3639,6 @@ TextureCubemap GenTexturePrefilter(Shader shader, TextureCubemap cubemap, int si
// Generate mipmaps for the prefiltered HDR texture
glGenerateMipmap(GL_TEXTURE_CUBE_MAP);
- //rlGenerateMipmaps(Texture2D *texture); // Only GL_TEXTURE_2D
// STEP 2: Draw to framebuffer
//------------------------------------------------------------------------------------------
@@ -4113,22 +4112,17 @@ static unsigned int LoadShaderProgram(unsigned int vShaderId, unsigned int fShad
TRACELOG(LOG_WARNING, "SHADER: [ID %i] Failed to link shader program", program);
int maxLength = 0;
- int length;
-
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &maxLength);
+
+ if (maxLength > 0)
+ {
+ int length;
+ char *log = RL_CALLOC(maxLength, sizeof(char));
+ glGetProgramInfoLog(program, maxLength, &length, log);
+ TRACELOG(LOG_WARNING, "SHADER: [ID %i] Link error: %s", program, log);
+ RL_FREE(log);
+ }
-#if defined(_MSC_VER)
- char *log = RL_MALLOC(maxLength);
-#else
- char log[maxLength];
-#endif
- glGetProgramInfoLog(program, maxLength, &length, log);
-
- TRACELOG(LOG_WARNING, "SHADER: [ID %i] Link error: %s", program, log);
-
-#if defined(_MSC_VER)
- RL_FREE(log);
-#endif
glDeleteProgram(program);
program = 0;