Skip to content

Commit

Permalink
Fixed few static analysis issues<2>
Browse files Browse the repository at this point in the history
1. In function main(int, char **) an exception of type
std::__1::system_error is thrown and never caught.
2. Assigning value MFX_ERR_INVALID_HANDLE to mfx_res here,
but that stored value is overwritten before it can be used.

Tracked-On: OAM-112437
Signed-off-by: zhangyichix <[email protected]>
  • Loading branch information
zhangyichix committed Oct 17, 2023
1 parent f4461b5 commit f8c286c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
8 changes: 4 additions & 4 deletions c2_store/src/mfx_c2_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ int main(int /* argc */, char** /* argv */) {
android::hardware::configureRpcThreadpool(8, true /* callerWillJoin */);

RegisterC2Service();

android::hardware::joinRpcThreadpool();

} catch(const std::exception& ex) {
// ALOGE("[email protected] exception: %s", ex.what());
return 0;
ALOGE("[email protected] exception: %s", ex.what());
}

android::hardware::joinRpcThreadpool();
return 0;
}
9 changes: 9 additions & 0 deletions c2_utils/src/mfx_va_frame_pool_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "mfx_c2_utils.h"
#include "mfx_debug.h"
#include "mfx_msdk_debug.h"

#include <C2AllocatorGralloc.h>

Expand Down Expand Up @@ -155,6 +156,13 @@ mfxStatus MfxVaFramePoolAllocator::AllocFrames(mfxFrameAllocRequest *request,
}
MFX_DEBUG_TRACE_I32(response->NumFrameActual);

if (MFX_ERR_NONE != mfx_res) {
MFX_DEBUG_TRACE_MSG("Fatal error occurred while allocating memory");

MFX_DEBUG_TRACE__mfxStatus(mfx_res);
return mfx_res;
}

if (response->NumFrameActual >= request->NumFrameMin) {
response->mids = mids.release();
m_pool = std::make_unique<MfxPool<C2GraphicBlock>>(); //release graphic buffer
Expand All @@ -172,6 +180,7 @@ mfxStatus MfxVaFramePoolAllocator::AllocFrames(mfxFrameAllocRequest *request,
mfx_res = AllocFrames(request, response);
}

MFX_DEBUG_TRACE__mfxStatus(mfx_res);
return mfx_res;
}

Expand Down

0 comments on commit f8c286c

Please sign in to comment.