summaryrefslogtreecommitdiffstats
path: root/domx
diff options
context:
space:
mode:
authorAlberto Aguirre <a-aguirre@ti.com>2012-10-10 13:21:13 -0500
committerSejal Barot <sejal@ti.com>2012-10-12 13:11:01 +0530
commit2d93a975d450ea525fdaa7c249ed0628ae14a783 (patch)
treefd84a851c71a23364b2f966bebe0ad567aea8fa1 /domx
parenta9f5f93ee1b72eb604115ac53fff91012ce2259c (diff)
downloadhardware_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-xdomx/omx_rpc/src/omx_rpc.c24
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");