Skip to content

Commit

Permalink
V4L/DVB (13017): gspca: kmalloc failure ignored in sd_start()
Browse files Browse the repository at this point in the history
Prevent NULL dereference if kmalloc() fails.

Cc: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Roel Kluin authored and Mauro Carvalho Chehab committed Sep 19, 2009
1 parent 8d04df4 commit d8370f7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/media/video/gspca/jeilinj.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ static int sd_start(struct gspca_dev *gspca_dev)

/* create the JPEG header */
dev->jpeg_hdr = kmalloc(JPEG_HDR_SZ, GFP_KERNEL);
if (dev->jpeg_hdr == NULL)
return -ENOMEM;
jpeg_define(dev->jpeg_hdr, gspca_dev->height, gspca_dev->width,
0x21); /* JPEG 422 */
jpeg_set_qual(dev->jpeg_hdr, dev->quality);
Expand Down

0 comments on commit d8370f7

Please sign in to comment.