diff options
author | Alberto Aguirre <a-aguirre@ti.com> | 2012-10-10 13:21:13 -0500 |
---|---|---|
committer | Sejal Barot <sejal@ti.com> | 2012-10-12 13:11:01 +0530 |
commit | 2d93a975d450ea525fdaa7c249ed0628ae14a783 (patch) | |
tree | fd84a851c71a23364b2f966bebe0ad567aea8fa1 /domx | |
parent | a9f5f93ee1b72eb604115ac53fff91012ce2259c (diff) | |
download | hardware_ti_omap4-2d93a975d450ea525fdaa7c249ed0628ae14a783.zip hardware_ti_omap4-2d93a975d450ea525fdaa7c249ed0628ae14a783.tar.gz hardware_ti_omap4-2d93a975d450ea525fdaa7c249ed0628ae14a783.tar.bz2 |
[DOMX OMXRPC] Fix memory leak
Fix memory leak when receiving OMX_ErrorHardware from the
remote core. In such cases, the listener will not free the
allocated packet; instead omx_rpc should check for this condition
and free the packet.
Change-Id: I3694a8fef4fee93495070671fe574abd61b3b948
Signed-off-by: Alberto Aguirre <a-aguirre@ti.com>
Diffstat (limited to 'domx')
-rwxr-xr-x | domx/omx_rpc/src/omx_rpc.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/domx/omx_rpc/src/omx_rpc.c b/domx/omx_rpc/src/omx_rpc.c index 0743491..e78d92b 100755 --- a/domx/omx_rpc/src/omx_rpc.c +++ b/domx/omx_rpc/src/omx_rpc.c @@ -369,10 +369,26 @@ void *RPC_CallbackThread(void *data) pBuffer = NULL; break; default: - eError = - TIMM_OSAL_WriteToPipe(pRPCCtx-> - pMsgPipe[nFxnIdx], &pBuffer, - RPC_MSG_SIZE_FOR_PIPE, TIMM_OSAL_SUSPEND); + if (((struct omx_packet *) pBuffer)->result == OMX_ErrorHardware) + { + //On a true OMX_ErrorHardware error, send the global error packet + //and release the local allocated packet to avoid memory leaks since + //the listener will not free the packet on OMX_ErrorHardware errors. + RPC_freePacket(pBuffer); + pBuffer = NULL; + ((struct omx_packet *) pBufferError)->result = OMX_ErrorHardware; + eError = TIMM_OSAL_WriteToPipe(pRPCCtx->pMsgPipe[nFxnIdx], + &pBuff, + RPC_MSG_SIZE_FOR_PIPE, + TIMM_OSAL_SUSPEND); + } + else + { + eError = TIMM_OSAL_WriteToPipe(pRPCCtx->pMsgPipe[nFxnIdx], + &pBuffer, + RPC_MSG_SIZE_FOR_PIPE, + TIMM_OSAL_SUSPEND); + } RPC_assert(eError == TIMM_OSAL_ERR_NONE, RPC_OMX_ErrorUndefined, "Write to pipe failed"); |