V4L/DVB (12421): drivers/media/video/gspca: introduce missing kfree
authorJulia Lawall <julia@diku.dk>
Wed, 5 Aug 2009 01:00:24 +0000 (22:00 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 12 Sep 2009 15:18:46 +0000 (12:18 -0300)
Error handling code following a kmalloc should free the allocated data.

Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Erik Andrén <erik.andren@gmail.com>
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/m5602/m5602_s5k83a.c

index 7127321ace8cbe35e893dd40025bbb901e60ee51..6b89f33a4ce015c0b6e0b9c9f69872dba1fd77e2 100644 (file)
@@ -178,8 +178,10 @@ sensor_found:
 
        sens_priv->settings =
        kmalloc(sizeof(s32)*ARRAY_SIZE(s5k83a_ctrls), GFP_KERNEL);
-       if (!sens_priv->settings)
+       if (!sens_priv->settings) {
+               kfree(sens_priv);
                return -ENOMEM;
+       }
 
        sd->gspca_dev.cam.cam_mode = s5k83a_modes;
        sd->gspca_dev.cam.nmodes = ARRAY_SIZE(s5k83a_modes);