msm: camera: Fixing memory leak issues in camera stack

Adding memory free calls to during error conditions to
fix memory leaks in platform probe.

CRs-Fixed: 975003
Change-Id: I7ecd7586e8662eaa6ec020963831e08af424be18
Signed-off-by: Vijay kumar Tumati <vtumati@codeaurora.org>
This commit is contained in:
Vijay kumar Tumati 2016-02-17 16:54:30 +05:30 committed by David Keitel
parent e663ad89f8
commit 4f956cf49f

View file

@ -1566,7 +1566,8 @@ static int msm_eeprom_platform_probe(struct platform_device *pdev)
e_ctrl->is_supported = 0;
if (!of_node) {
pr_err("%s dev.of_node NULL\n", __func__);
return -EINVAL;
rc = -EINVAL;
goto ectrl_free;
}
/* Set platform device handle */
@ -1578,7 +1579,8 @@ static int msm_eeprom_platform_probe(struct platform_device *pdev)
struct msm_camera_cci_client), GFP_KERNEL);
if (!e_ctrl->i2c_client.cci_client) {
pr_err("%s failed no memory\n", __func__);
return -ENOMEM;
rc = -ENOMEM;
goto ectrl_free;
}
e_ctrl->eboard_info = kzalloc(sizeof(
@ -1628,7 +1630,7 @@ static int msm_eeprom_platform_probe(struct platform_device *pdev)
}
rc = msm_eeprom_get_dt_data(e_ctrl);
if (rc)
if (rc < 0)
goto board_free;
if (e_ctrl->userspace_probe == 0) {
@ -1723,6 +1725,7 @@ board_free:
kfree(e_ctrl->eboard_info);
cciclient_free:
kfree(e_ctrl->i2c_client.cci_client);
ectrl_free:
kfree(e_ctrl);
return rc;
}