Source

gltut / framework / framework.cpp

Diff from to

framework/framework.cpp

 	{
 		try
 		{
-			return glutil::LinkProgram(shaderList);
+			GLuint prog = glutil::LinkProgram(shaderList);
+			std::for_each(shaderList.begin(), shaderList.end(), glDeleteShader);
+			return prog;
 		}
 		catch(std::exception &e)
 		{
+			std::for_each(shaderList.begin(), shaderList.end(), glDeleteShader);
 			fprintf(stderr, "%s\n", e.what());
 			throw;
 		}
-
-		std::for_each(shaderList.begin(), shaderList.end(), glDeleteShader);
 	}
 
 	float DegToRad(float fAngDeg)