mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-11-26 05:10:05 +00:00
Avoid undefined pointer given to spvTextDestroy
The undefined pointer might get through to the call to spvTextDestroy if the test fails on an earlier step. In that case I just want to see the test failure, and not a test failure followed by undefined behaviour.
This commit is contained in:
parent
26b3b00887
commit
43f0e819c4
@ -147,7 +147,7 @@ TEST(BinaryToTextSmall, OneInstruction) {
|
||||
spvTextToBinary(input, strlen(input), opcodeTable, operandTable,
|
||||
extInstTable, &binary, &diagnostic);
|
||||
ASSERT_EQ(SPV_SUCCESS, error);
|
||||
spv_text text;
|
||||
spv_text text = nullptr;
|
||||
error = spvBinaryToText(binary->code, binary->wordCount,
|
||||
SPV_BINARY_TO_TEXT_OPTION_NONE, opcodeTable,
|
||||
operandTable, extInstTable, &text, &diagnostic);
|
||||
@ -182,7 +182,7 @@ TEST(BinaryToTextSmall, OperandWithOperands) {
|
||||
spvTextToBinary(input.str.c_str(), input.str.length(), opcodeTable,
|
||||
operandTable, extInstTable, &binary, &diagnostic);
|
||||
ASSERT_EQ(SPV_SUCCESS, error);
|
||||
spv_text text;
|
||||
spv_text text = nullptr;
|
||||
error = spvBinaryToText(binary->code, binary->wordCount,
|
||||
SPV_BINARY_TO_TEXT_OPTION_NONE, opcodeTable,
|
||||
operandTable, extInstTable, &text, &diagnostic);
|
||||
|
@ -111,7 +111,7 @@ OpFunctionEnd
|
||||
<< "in\n" << spvtest::WordVector(*binary).str();
|
||||
|
||||
// Check round trip gives the same text.
|
||||
spv_text output_text;
|
||||
spv_text output_text = nullptr;
|
||||
error = spvBinaryToText(
|
||||
binary->code, binary->wordCount, SPV_BINARY_TO_TEXT_OPTION_NONE,
|
||||
opcodeTable, operandTable, extInstTable, &output_text, &diagnostic);
|
||||
|
Loading…
Reference in New Issue
Block a user