Skip to content

Commit

Permalink
[media] pvrusb2: check for allocation failures
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Mauro Carvalho Chehab committed May 20, 2011
1 parent ce02704 commit 0cff593
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/media/video/pvrusb2/pvrusb2-std.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,11 @@ struct v4l2_standard *pvr2_std_create_enum(unsigned int *countptr,

stddefs = kzalloc(sizeof(struct v4l2_standard) * std_cnt,
GFP_KERNEL);
for (idx = 0; idx < std_cnt; idx++) stddefs[idx].index = idx;
if (!stddefs)
return NULL;

for (idx = 0; idx < std_cnt; idx++)
stddefs[idx].index = idx;

idx = 0;

Expand Down

0 comments on commit 0cff593

Please sign in to comment.