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

Commit 3f52b495 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "radio: iris: Avoid memory leak and NULL pointer dereferencing"

parents 1b16d4e8 601b9ca8
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -4275,13 +4275,13 @@ static int __init iris_probe(struct platform_device *pdev)
		if (kfifo_alloc_rc != 0) {
			FMDERR("failed allocating buffers %d\n",
				   kfifo_alloc_rc);
			for (; i > -1; i--) {
			for (; i > -1; i--)
				kfifo_free(&radio->data_buf[i]);
			video_device_release(radio->videodev);
			kfree(radio);
			return -ENOMEM;
		}
	}
	}

	mutex_init(&radio->lock);
	init_completion(&radio->sync_xfr_start);
@@ -4307,8 +4307,16 @@ static int __init iris_probe(struct platform_device *pdev)
	} else {
		priv_videodev = kzalloc(sizeof(struct video_device),
			GFP_KERNEL);
		if (priv_videodev != NULL) {
			memcpy(priv_videodev, radio->videodev,
				sizeof(struct video_device));
		} else {
			video_unregister_device(radio->videodev);
			video_device_release(radio->videodev);
			for (; i > -1; i--)
				kfifo_free(&radio->data_buf[i]);
			kfree(radio);
		}
	}
	return 0;
}