From: Guenter Roeck Date: Sat, 24 Sep 2011 22:27:04 +0000 (-0700) Subject: hwmon: (coretemp) Avoid leaving around dangling pointer X-Git-Tag: v3.1-rc9~7^2 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=20ecb499f64a7e8e7fe03f6098ab25c71b7a6481;p=~emulex%2Finfiniband.git hwmon: (coretemp) Avoid leaving around dangling pointer Storing the struct temp_data pointer allocated from create_core_data() when returning an error has the potential of leaving around a pointer to freed memory. Reset it to NULL for error returns. Reported-by: Jan Beulich Signed-off-by: Guenter Roeck Acked-by: Jean Delvare --- diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index cf5b1de32c0..93238378664 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -506,6 +506,7 @@ static int create_core_data(struct platform_device *pdev, return 0; exit_free: + pdata->core_data[attr_no] = NULL; kfree(tdata); return err; }