Leak fix: delete GLSL shader objects if we fail to compile.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 23 Mar 2013 22:51:35 -0400
changeset 1124 464fc9101a7e
parent 1123 3d842e7dd6ad
child 1125 3de60f597ebd
Leak fix: delete GLSL shader objects if we fail to compile.
mojoshader_opengl.c
--- a/mojoshader_opengl.c	Fri Feb 15 15:10:33 2013 -0500
+++ b/mojoshader_opengl.c	Sat Mar 23 22:51:35 2013 -0400
@@ -402,6 +402,7 @@
             GLsizei len = 0;
             ctx->glGetInfoLogARB(shader, sizeof (error_buffer), &len,
                                  (GLchar *) error_buffer);
+            ctx->glDeleteShader(shader);
             *s = 0;
             return 0;
         } // if
@@ -421,6 +422,7 @@
             GLsizei len = 0;
             ctx->glGetInfoLogARB(shader, sizeof (error_buffer), &len,
                                  (GLcharARB *) error_buffer);
+            ctx->glDeleteObjectARB(shader);
             *s = 0;
             return 0;
         } // if