* [patch] dereferencing freed in saa5249.c
@ 2009-04-10 9:00 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2009-04-10 9:00 UTC (permalink / raw)
To: linux-kernel
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
different error path.
regards,
dan carpenter
Signed-off-by: Dan Carpenter <error27@gmail.com>
--- orig/drivers/media/video/saa5249.c 2009-04-09 23:54:15.000000000 +0300
+++ devel/drivers/media/video/saa5249.c 2009-04-09 23:59:16.000000000 +0300
@@ -598,6 +598,7 @@
/* Now create a video4linux device */
t->vdev = video_device_alloc();
if (t->vdev == NULL) {
+ kfree(t);
kfree(client);
return -ENOMEM;
}
@@ -617,9 +618,8 @@
/* 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-10 9:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-10 9:00 [patch] dereferencing freed in saa5249.c Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).