aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2011-03-25 21:52:22 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 08:28:24 -0400
commit0cff593732fa5bdf07192be741a567b85a9c0cd3 (patch)
tree8a02817ba8409f815a69a1a02f7cbd840a351a43 /drivers/media/video
parentce02704d48767bdd31eb0b804b1d45da5b683a8c (diff)
[media] pvrusb2: check for allocation failures
This function returns NULL on failure so lets do that if kzalloc() fails. There is a separate problem that the caller for this function doesn't check for errors... Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-By: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-std.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-std.c b/drivers/media/video/pvrusb2/pvrusb2-std.c
index ca9f83a85ca..35c8b405982 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-std.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-std.c
@@ -370,7 +370,11 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int *countptr,
370 370
371 stddefs = kzalloc(sizeof(struct v4l2_standard) * std_cnt, 371 stddefs = kzalloc(sizeof(struct v4l2_standard) * std_cnt,
372 GFP_KERNEL); 372 GFP_KERNEL);
373 for (idx = 0; idx < std_cnt; idx++) stddefs[idx].index = idx; 373 if (!stddefs)
374 return NULL;
375
376 for (idx = 0; idx < std_cnt; idx++)
377 stddefs[idx].index = idx;
374 378
375 idx = 0; 379 idx = 0;
376 380