Fix leak - using no fancy smanshy new age voodoo (#2390)

This commit is contained in:
pheonix 2021-02-11 21:43:22 -08:00 committed by GitHub
parent 0cbc215c02
commit d89ff312a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -625,15 +625,15 @@ namespace bgfx { namespace metal
glslang::InitializeProcess();
glslang::TProgram* program = new glslang::TProgram;
EShLanguage stage = getLang(_options.shaderType);
if (EShLangCount == stage)
{
bx::printf("Error: Unknown shader type '%c'.\n", _options.shaderType);
return false;
}
glslang::TShader* shader = new glslang::TShader(stage);
glslang::TProgram* program = new glslang::TProgram;
glslang::TShader* shader = new glslang::TShader(stage);
EShMessages messages = EShMessages(0
| EShMsgDefault
@ -788,6 +788,8 @@ namespace bgfx { namespace metal
}
// recompile with the unused uniforms converted to statics
delete program;
delete shader;
return compile(_options, _version, output.c_str(), _writer, false);
}

View File

@ -741,15 +741,15 @@ namespace bgfx { namespace spirv
glslang::InitializeProcess();
glslang::TProgram* program = new glslang::TProgram;
EShLanguage stage = getLang(_options.shaderType);
if (EShLangCount == stage)
{
bx::printf("Error: Unknown shader type '%c'.\n", _options.shaderType);
return false;
}
glslang::TShader* shader = new glslang::TShader(stage);
glslang::TProgram* program = new glslang::TProgram;
glslang::TShader* shader = new glslang::TShader(stage);
EShMessages messages = EShMessages(0
| EShMsgDefault
@ -934,6 +934,8 @@ namespace bgfx { namespace spirv
output = uniformBlock + output;
// recompile with the unused uniforms converted to statics
delete program;
delete shader;
return compile(_options, _version, output.c_str(), _writer, false);
}
else