Skip to content

Commit 9fd2b21

Browse files
jinyuan-devgfxVPLsdm
authored andcommitted
[RT Common] Fix error handling in mfxDefaultAllocatorVAAPI::AllocFramesHW
Modified AllocFramesHW to properly capture and propagate error status from CheckAndDestroyVAbuffer during cleanup of allocated VA buffers. This ensures error conditions during cleanup are properly reported to callers, and avoids early exits when error is met before destroying all allocated buffers.
1 parent 8483641 commit 9fd2b21

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

_studio/shared/src/libmfx_allocator_vaapi.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,11 +439,16 @@ mfxDefaultAllocatorVAAPI::AllocFramesHW(
439439
else
440440
{
441441
// Some of vaCreateBuffer calls failed
442+
mfxStatus cleanup_sts = MFX_ERR_NONE;
442443
for (VABufferID& coded_buf : allocated_surfaces)
443444
{
444445
mfxStatus sts = CheckAndDestroyVAbuffer(self->m_pVADisplay, coded_buf);
445-
MFX_CHECK_STS(sts);
446+
if ((MFX_ERR_NONE != sts) && (cleanup_sts == MFX_ERR_NONE))
447+
{
448+
cleanup_sts = sts; // Preserve the first failure encountered
449+
}
446450
}
451+
MFX_CHECK_STS(cleanup_sts);
447452
}
448453

449454
return mfx_res;

0 commit comments

Comments
 (0)