V4L/DVB (13018): kzalloc failure ignored in au8522_probe()
authorRoel Kluin <roel.kluin@gmail.com>
Sat, 19 Sep 2009 00:03:34 +0000 (21:03 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 19 Sep 2009 03:53:35 +0000 (00:53 -0300)
Prevent NULL dereference if kzalloc() fails.

Cc: Devin Heitmueller <dheitmueller@linuxtv.org>
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>
drivers/media/dvb/frontends/au8522_decoder.c

index 9e9a75576a1dab6595d65ad6f3e22ebb6697d502..74981ee923c8a58259cc30cfa4e7e99194de4fd3 100644 (file)
@@ -792,6 +792,11 @@ static int au8522_probe(struct i2c_client *client,
        }
 
        demod_config = kzalloc(sizeof(struct au8522_config), GFP_KERNEL);
+       if (demod_config == NULL) {
+               if (instance == 1)
+                       kfree(state);
+               return -ENOMEM;
+       }
        demod_config->demod_address = 0x8e >> 1;
 
        state->config = demod_config;