spvtest::Validate::CompileFailure: Don't leak the diagnostic (#2564)

This commit is contained in:
David Neto 2019-05-07 22:01:06 -04:00 committed by GitHub
parent b74d92a8c3
commit d0a1f5a05a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,6 +21,7 @@
#include <string>
#include "source/val/validation_state.h"
#include "spirv-tools/libspirv.h"
#include "test/test_fixture.h"
#include "test/unit_spirv.h"
@ -113,6 +114,7 @@ std::string ValidateBase<T>::CompileFailure(std::string code,
spvTextToBinary(ScopedContext(env).context, code.c_str(),
code.size(), &binary_, &diagnostic));
std::string result(diagnostic->error);
spvDiagnosticDestroy(diagnostic);
return result;
}