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

Commit ee893e9a authored by Julia Lawall's avatar Julia Lawall Committed by Mauro Carvalho Chehab
Browse files

[media] drivers/media/video: add missing kfree



Free the recently allocated qcam in each case.

The semantic match that finds this problem is as follows:

// <smpl>
@r@
identifier x;
@@

kfree(x)

@@
identifier r.x;
expression E1!=0,E2,E3,E4;
statement S;
@@

(
if (<+...x...+>) S
|
if (...) { ... when != kfree(x)
               when != if (...) { ... kfree(x); ... }
               when != x = E3
* return E1;
}
... when != x = E2
if (...) { ... when != x = E4
 kfree(x); ... return ...; }
)
// </smpl>

Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 37f9619d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -893,6 +893,7 @@ static struct qcam *qcam_init(struct parport *port)

	if (v4l2_device_register(NULL, v4l2_dev) < 0) {
		v4l2_err(v4l2_dev, "Could not register v4l2_device\n");
		kfree(qcam);
		return NULL;
	}

+1 −0
Original line number Diff line number Diff line
@@ -750,6 +750,7 @@ static struct qcam *qcam_init(struct parport *port)

	if (v4l2_device_register(NULL, v4l2_dev) < 0) {
		v4l2_err(v4l2_dev, "Could not register v4l2_device\n");
		kfree(qcam);
		return NULL;
	}