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

Commit fde89020 authored by Srinu Gorle's avatar Srinu Gorle Committed by TALU
Browse files

msm: vidc: Fix memory leak issue



Amend error condition to avoid memory leak issues.

CRs-Fixed: 2091851
Change-Id: Id7ee9127ba3a22857d667e854ad7bdc0510f3995
Signed-off-by: default avatarSrinu Gorle <sgorle@codeaurora.org>
Signed-off-by: default avatarSanjay Singh <sisanj@codeaurora.org>
parent 8c2559c8
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -493,12 +493,16 @@ static int msm_vidc_probe(struct platform_device *pdev)
	struct device *dev;
	int nr = BASE_DEVICE_NUMBER;

	if (!vidc_driver) {
		dprintk(VIDC_ERR, "Invalid vidc driver\n");
		return -EINVAL;
	}

	core = kzalloc(sizeof(*core), GFP_KERNEL);
	if (!core || !vidc_driver) {
	if (!core) {
		dprintk(VIDC_ERR,
			"Failed to allocate memory for device core\n");
		rc = -ENOMEM;
		goto err_no_mem;
		return -ENOMEM;
	}
	rc = msm_vidc_initialize_core(pdev, core);
	if (rc) {
@@ -628,7 +632,6 @@ err_v4l2_register:
	sysfs_remove_group(&pdev->dev.kobj, &msm_vidc_core_attr_group);
err_core_init:
	kfree(core);
err_no_mem:
	return rc;
}