mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
msm: vidc: Add the change to prevent memory leak
Memory allocated for "buf_entry" and "sched_cctxt" is not freed in case if error is returned. This change prevents possible memory leak in video decoder driver. CRs-fixed: 432323 Change-Id: I1c8775fb701f1568f704b6ddbb4e835304d2a817 Signed-off-by: Shobhit Pandey <cshopan@codeaurora.org>
This commit is contained in:
parent
e1e791dcf5
commit
17df18df57
2 changed files with 14 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2010-2013, Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -214,7 +214,7 @@ void vidc_pix_cache_set_ram(u32 ram_select)
|
||||||
VIDC_HWIO_IN(REG_261029, &dmi_cfg_reg);
|
VIDC_HWIO_IN(REG_261029, &dmi_cfg_reg);
|
||||||
dmi_cfg_reg &= (~HWIO_REG_261029_DMI_RAM_SEL_BMSK);
|
dmi_cfg_reg &= (~HWIO_REG_261029_DMI_RAM_SEL_BMSK);
|
||||||
dmi_cfg_reg |= VIDC_SETFIELD(ram_select,
|
dmi_cfg_reg |= VIDC_SETFIELD(ram_select,
|
||||||
HWIO_REG_261029_AUTO_INC_EN_SHFT,
|
HWIO_REG_261029_DMI_RAM_SEL_SHFT,
|
||||||
HWIO_REG_261029_DMI_RAM_SEL_BMSK);
|
HWIO_REG_261029_DMI_RAM_SEL_BMSK);
|
||||||
VIDC_HWIO_OUT(REG_261029, dmi_cfg_reg);
|
VIDC_HWIO_OUT(REG_261029, dmi_cfg_reg);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved.
|
/* Copyright (c) 2010-2013, Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -2011,8 +2011,11 @@ u32 vcd_handle_input_done(
|
||||||
return VCD_ERR_FAIL;
|
return VCD_ERR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (orig_frame != transc->ip_buf_entry)
|
if (orig_frame != transc->ip_buf_entry) {
|
||||||
|
VCD_MSG_HIGH("%s: free duplicate buffer", __func__);
|
||||||
kfree(transc->ip_buf_entry);
|
kfree(transc->ip_buf_entry);
|
||||||
|
transc->ip_buf_entry = NULL;
|
||||||
|
}
|
||||||
transc->ip_buf_entry = NULL;
|
transc->ip_buf_entry = NULL;
|
||||||
transc->input_done = true;
|
transc->input_done = true;
|
||||||
|
|
||||||
|
@ -2781,6 +2784,7 @@ u32 vcd_handle_input_frame(
|
||||||
struct vcd_frame_data *frm_entry;
|
struct vcd_frame_data *frm_entry;
|
||||||
u32 rc = VCD_S_SUCCESS;
|
u32 rc = VCD_S_SUCCESS;
|
||||||
u32 eos_handled = false;
|
u32 eos_handled = false;
|
||||||
|
u32 duplicate_buffer = false;
|
||||||
|
|
||||||
VCD_MSG_LOW("vcd_handle_input_frame:");
|
VCD_MSG_LOW("vcd_handle_input_frame:");
|
||||||
|
|
||||||
|
@ -2864,6 +2868,8 @@ u32 vcd_handle_input_frame(
|
||||||
buf_entry->allocated = orig_frame->allocated;
|
buf_entry->allocated = orig_frame->allocated;
|
||||||
buf_entry->in_use = 1; /* meaningless for the dupe buffers */
|
buf_entry->in_use = 1; /* meaningless for the dupe buffers */
|
||||||
buf_entry->frame = orig_frame->frame;
|
buf_entry->frame = orig_frame->frame;
|
||||||
|
duplicate_buffer = true;
|
||||||
|
VCD_MSG_HIGH("%s: duplicate buffer", __func__);
|
||||||
} else
|
} else
|
||||||
buf_entry = orig_frame;
|
buf_entry = orig_frame;
|
||||||
|
|
||||||
|
@ -2887,6 +2893,10 @@ u32 vcd_handle_input_frame(
|
||||||
if (VCD_FAILED(rc) || eos_handled) {
|
if (VCD_FAILED(rc) || eos_handled) {
|
||||||
VCD_MSG_HIGH("rc = 0x%x, eos_handled = %d", rc,
|
VCD_MSG_HIGH("rc = 0x%x, eos_handled = %d", rc,
|
||||||
eos_handled);
|
eos_handled);
|
||||||
|
if ((duplicate_buffer) && (buf_entry)) {
|
||||||
|
kfree(buf_entry);
|
||||||
|
buf_entry = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue