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

Commit 5b83cfa9 authored by Dan Carpenter's avatar Dan Carpenter Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (11515): drivers/media/video/saa5249.c: fix use-after-free and leak



I moved the kfree() down a couple lines.  t->vdev is going to be in freed
memory so there is no point setting it to NULL.  I added a kfree(t) on a

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 3964b58a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -598,6 +598,7 @@ static int saa5249_probe(struct i2c_client *client,
	/* Now create a video4linux device */
	t->vdev = video_device_alloc();
	if (t->vdev == NULL) {
		kfree(t);
		kfree(client);
		return -ENOMEM;
	}
@@ -617,9 +618,8 @@ static int saa5249_probe(struct i2c_client *client,
	/* Register it */
	err = video_register_device(t->vdev, VFL_TYPE_VTX, -1);
	if (err < 0) {
		kfree(t);
		video_device_release(t->vdev);
		t->vdev = NULL;
		kfree(t);
		return err;
	}
	return 0;