[legacy]: Fix vpu_api_test memory leak issue

Data in DecoderOut_t is malloc from vpu_api_legacy. And Android OMX
component is following this rule for historical reason. We have to
change test case to support it.

Change-Id: I202525eecc461bd9507cfa2c376de11e2fc6fc9b
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen 2018-03-27 16:17:59 +08:00
parent 02e340d445
commit 5d6b20385e

View File

@ -563,12 +563,6 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
memset(&decOut, 0, sizeof(DecoderOut_t));
pOut = &decOut;
pOut->data = (RK_U8 *)(malloc)(sizeof(VPU_FRAME));
if (pOut->data == NULL) {
DECODE_ERR_RET(ERROR_MEMORY);
}
memset(pOut->data, 0, sizeof(VPU_FRAME));
ret = vpu_open_context(&ctx);
if (ret || (ctx == NULL)) {
DECODE_ERR_RET(ERROR_MEMORY);
@ -693,6 +687,9 @@ static RK_S32 vpu_decode_demo(VpuApiDemoCmdContext_t *cmd)
** give you a surprise.
*/
VPUFreeLinear(&frame->vpumem);
// NOTE: pOut->data is malloc from vpu_api we need to free it.
free(pOut->data);
pOut->data = NULL;
pOut->size = 0;
}
}