Double free in compileShader
Closed this issue · 2 comments
JDuchniewicz commented
If an array is allocated in a scope on stack it will be freed upon scope's end. Also freeing stack allocated memory is UB.
This code is the culprit:
if (infoLen > 1) {
char infoLog[infoLen];
// And print them out
glGetShaderInfoLog(shader, infoLen, NULL, infoLog);
printf("%s\n", infoLog);
free(infoLog);
}
I opened a PR to fix it #1
DanRuta commented
Thank you for the tip (and the PR). It's been some years since I've worked with this, so I'll take your word for it that there's no memory leaks. Let me know if you find out otherwise.
JDuchniewicz commented
Thanks for the library! I am developing a GPGPU application for SGX GPU's and your code is a good learning material (well structured GL calls and good function splitting).
As for the memory leak, trust in the standard 😄