提交 d8370f7e 编写于 作者: R Roel Kluin 提交者: Mauro Carvalho Chehab

V4L/DVB (13017): gspca: kmalloc failure ignored in sd_start()

Prevent NULL dereference if kmalloc() fails.

Cc: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: NRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: NDouglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 8d04df49
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册