Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
msm: camera: Fix memory leak in cam_res_mgr_probe()
Browse files Browse the repository at this point in the history
Since we have multiple CCIs with qcom,cam-res-mgr defined, the global
cam_res pointer gets overwritten each time a CCI probes, causing memory
to be leaked. Since it appears that the single global cam_res pointer is
intentional, let's just skip superfluous cam_res allocations to fix the
leak.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: LibXZR <xzr467706992@163.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
  • Loading branch information
kerneltoast authored and UtsavBalar1231 committed Jul 23, 2021
1 parent 99482df commit 51b50bb
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,9 @@ static int cam_res_mgr_probe(struct platform_device *pdev)
{
int rc = 0;

if (cam_res)
return 0;

cam_res = kzalloc(sizeof(*cam_res), GFP_KERNEL);
if (!cam_res)
return -ENOMEM;
Expand Down

0 comments on commit 51b50bb

Please sign in to comment.