Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6bdb5c5c authored by Haifeng Xu's avatar Haifeng Xu
Browse files

media: dvb: fix the ION output buffer memory leak



Current code does not release the reference to ION buffers
when closing the decoder instance and this causes memory leak
problem. The changes are made to fix the problem by releasing
ION buffers when the decoder instance is closed.

Change-Id: Ice4d20243c99c6db538da67e275beb85b5fab5c5
Signed-off-by: default avatarHaifeng Xu <haifeng@codeaurora.org>
parent 51f18552
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -1356,12 +1356,19 @@ static int mpq_dvb_free_output_buffers(
	struct v4l2_instance *v4l2_inst)
	struct v4l2_instance *v4l2_inst)
{
{
	int rc = 0;
	int rc = 0;
	int i;
	struct v4l2_requestbuffers v4l2_buffer_req;
	struct v4l2_requestbuffers v4l2_buffer_req;
	struct buffer_info *pbuf;
	DBG("ENTER mpq_dvb_free_output_buf\n");
	DBG("ENTER mpq_dvb_free_output_buf\n");
	if (!v4l2_inst) {
	if (!v4l2_inst) {
		ERR("[%s]Input parameter is NULL or invalid\n", __func__);
		ERR("[%s]Input parameter is NULL or invalid\n", __func__);
		return -EINVAL;
		return -EINVAL;
	}
	}
	for (i = 0; i < v4l2_inst->num_output_buffers; i++) {
		pbuf = &v4l2_inst->buf_info[CAPTURE_PORT][i];
		if (pbuf->handle)
			msm_vidc_smem_free(v4l2_inst->vidc_inst, pbuf->handle);
	}
	rc = msm_vidc_release_buffers(
	rc = msm_vidc_release_buffers(
	   v4l2_inst->vidc_inst,
	   v4l2_inst->vidc_inst,
	   V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);
	   V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE);