Fix a memory leak for rocJpegNegativeTests (#177)
[ROCm/rocjpeg commit: 6fc7c634f6]
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ee70ec5860
Коммит
808ce9591a
+20
@@ -226,6 +226,11 @@ int RocJpegApiNegativeTests::TestInvalidCreate() {
|
||||
std::cerr << "Expected ROCJPEG_STATUS_EXECUTION_FAILED but got " << rocJpegGetErrorName(rocjpeg_status) << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
rocjpeg_status = rocJpegDestroy(rocjpeg_handle_);
|
||||
if (rocjpeg_status != ROCJPEG_STATUS_SUCCESS) {
|
||||
std::cerr << "Expected ROCJPEG_STATUS_SUCCESS but got " << rocJpegGetErrorName(rocjpeg_status) << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Scenario 3: Pass valid pointer for handle but invalid device_id
|
||||
device_id = 255; // Invalid device ID
|
||||
@@ -234,6 +239,11 @@ int RocJpegApiNegativeTests::TestInvalidCreate() {
|
||||
std::cerr << "Expected ROCJPEG_STATUS_INVALID_PARAMETER but got " << rocJpegGetErrorName(rocjpeg_status) << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
rocjpeg_status = rocJpegDestroy(rocjpeg_handle_);
|
||||
if (rocjpeg_status != ROCJPEG_STATUS_SUCCESS) {
|
||||
std::cerr << "Expected ROCJPEG_STATUS_SUCCESS but got " << rocJpegGetErrorName(rocjpeg_status) << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Scenario 4: Pass valid pointer for handle but unsupported backend
|
||||
device_id = 0;
|
||||
@@ -242,6 +252,11 @@ int RocJpegApiNegativeTests::TestInvalidCreate() {
|
||||
std::cerr << "Expected ROCJPEG_STATUS_NOT_IMPLEMENTED but got " << rocJpegGetErrorName(rocjpeg_status) << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
rocjpeg_status = rocJpegDestroy(rocjpeg_handle_);
|
||||
if (rocjpeg_status != ROCJPEG_STATUS_SUCCESS) {
|
||||
std::cerr << "Expected ROCJPEG_STATUS_SUCCESS but got " << rocJpegGetErrorName(rocjpeg_status) << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Scenario 5: Use an unsupported backend
|
||||
RocJpegBackend backend = static_cast<RocJpegBackend>(-1);
|
||||
@@ -250,6 +265,11 @@ int RocJpegApiNegativeTests::TestInvalidCreate() {
|
||||
std::cerr << "Expected ROCJPEG_STATUS_INVALID_PARAMETER but got " << rocJpegGetErrorName(rocjpeg_status) << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
rocjpeg_status = rocJpegDestroy(rocjpeg_handle_);
|
||||
if (rocjpeg_status != ROCJPEG_STATUS_SUCCESS) {
|
||||
std::cerr << "Expected ROCJPEG_STATUS_SUCCESS but got " << rocJpegGetErrorName(rocjpeg_status) << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
// Create a valid rocJPEG handle - This step ensures a valid rocjpeg_handle_ is available for subsequent negative testing of other rocJPEG APIs.
|
||||
rocjpeg_status = rocJpegCreate(ROCJPEG_BACKEND_HARDWARE, device_id, &rocjpeg_handle_);
|
||||
|
||||
Ссылка в новой задаче
Block a user