Fix a memory leak for rocDecodeNegativeTests (#643)
This commit is contained in:
committato da
GitHub
parent
b4ec9ca411
commit
a5e4cd780e
@@ -45,6 +45,11 @@ int RocDecodeApiNegativeTests::TestInvalidCreateDecoder() {
|
|||||||
std::cerr << "Expected ROCDEC_INVALID_PARAMETER but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
std::cerr << "Expected ROCDEC_INVALID_PARAMETER but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
rocdecode_status = rocDecDestroyDecoder(decoder_handle_);
|
||||||
|
if (rocdecode_status != ROCDEC_SUCCESS) {
|
||||||
|
std::cerr << "Expected ROCDEC_SUCCESS but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Scenario 3: Pass invalid device_id in decoder_create_info
|
// Scenario 3: Pass invalid device_id in decoder_create_info
|
||||||
decoder_create_info_.device_id = 255; // Assuming 255 is an invalid device ID
|
decoder_create_info_.device_id = 255; // Assuming 255 is an invalid device ID
|
||||||
@@ -54,6 +59,11 @@ int RocDecodeApiNegativeTests::TestInvalidCreateDecoder() {
|
|||||||
std::cerr << "Expected ROCDEC_NOT_SUPPORTED but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
std::cerr << "Expected ROCDEC_NOT_SUPPORTED but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
rocdecode_status = rocDecDestroyDecoder(decoder_handle_);
|
||||||
|
if (rocdecode_status != ROCDEC_SUCCESS) {
|
||||||
|
std::cerr << "Expected ROCDEC_SUCCESS but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Scenario 4: Pass zero width and height in decoder_create_info
|
// Scenario 4: Pass zero width and height in decoder_create_info
|
||||||
decoder_create_info_.device_id = 0; // Reset to valid device ID
|
decoder_create_info_.device_id = 0; // Reset to valid device ID
|
||||||
@@ -64,6 +74,11 @@ int RocDecodeApiNegativeTests::TestInvalidCreateDecoder() {
|
|||||||
std::cerr << "Expected ROCDEC_NOT_SUPPORTED but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
std::cerr << "Expected ROCDEC_NOT_SUPPORTED but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
rocdecode_status = rocDecDestroyDecoder(decoder_handle_);
|
||||||
|
if (rocdecode_status != ROCDEC_SUCCESS) {
|
||||||
|
std::cerr << "Expected ROCDEC_SUCCESS but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Scenario 5: Pass unsupported codec type
|
// Scenario 5: Pass unsupported codec type
|
||||||
decoder_create_info_.width = 1920;
|
decoder_create_info_.width = 1920;
|
||||||
@@ -74,6 +89,11 @@ int RocDecodeApiNegativeTests::TestInvalidCreateDecoder() {
|
|||||||
std::cerr << "Expected ROCDEC_NOT_SUPPORTED but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
std::cerr << "Expected ROCDEC_NOT_SUPPORTED but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
rocdecode_status = rocDecDestroyDecoder(decoder_handle_);
|
||||||
|
if (rocdecode_status != ROCDEC_SUCCESS) {
|
||||||
|
std::cerr << "Expected ROCDEC_SUCCESS but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Scenario 6: Pass unsupported chroma_format
|
// Scenario 6: Pass unsupported chroma_format
|
||||||
decoder_create_info_.codec_type = rocDecVideoCodec_HEVC;
|
decoder_create_info_.codec_type = rocDecVideoCodec_HEVC;
|
||||||
@@ -83,6 +103,11 @@ int RocDecodeApiNegativeTests::TestInvalidCreateDecoder() {
|
|||||||
std::cerr << "Expected ROCDEC_NOT_SUPPORTED but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
std::cerr << "Expected ROCDEC_NOT_SUPPORTED but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
rocdecode_status = rocDecDestroyDecoder(decoder_handle_);
|
||||||
|
if (rocdecode_status != ROCDEC_SUCCESS) {
|
||||||
|
std::cerr << "Expected ROCDEC_SUCCESS but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Scenario 7: Pass unsupported bit_depth
|
// Scenario 7: Pass unsupported bit_depth
|
||||||
decoder_create_info_.chroma_format = rocDecVideoChromaFormat_420;
|
decoder_create_info_.chroma_format = rocDecVideoChromaFormat_420;
|
||||||
@@ -92,6 +117,11 @@ int RocDecodeApiNegativeTests::TestInvalidCreateDecoder() {
|
|||||||
std::cerr << "Expected ROCDEC_NOT_SUPPORTED but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
std::cerr << "Expected ROCDEC_NOT_SUPPORTED but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
rocdecode_status = rocDecDestroyDecoder(decoder_handle_);
|
||||||
|
if (rocdecode_status != ROCDEC_SUCCESS) {
|
||||||
|
std::cerr << "Expected ROCDEC_SUCCESS but got " << rocDecGetErrorName(rocdecode_status) << std::endl;
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Create a valid decoder_handle - This step ensures a valid decoder_handle_ is available for subsequent negative testing of other rocDecode APIs.
|
// Create a valid decoder_handle - This step ensures a valid decoder_handle_ is available for subsequent negative testing of other rocDecode APIs.
|
||||||
decoder_create_info_.bit_depth_minus_8 = 2;
|
decoder_create_info_.bit_depth_minus_8 = 2;
|
||||||
|
|||||||
Fai riferimento in un nuovo problema
Block a user