diff options
author | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-09-24 18:27:04 -0400 |
---|---|---|
committer | Guenter Roeck <guenter.roeck@ericsson.com> | 2011-09-28 11:19:21 -0400 |
commit | 20ecb499f64a7e8e7fe03f6098ab25c71b7a6481 (patch) | |
tree | 6cd20d373c279a92acb8917c2945c6132ce66486 /drivers/hwmon/coretemp.c | |
parent | 0eb9782ad9b1bd496ba61cd5ea27ccb8db21e885 (diff) |
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 <jbeulich@suse.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/coretemp.c')
-rw-r--r-- | drivers/hwmon/coretemp.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index cf5b1de32c0a..932383786642 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c | |||
@@ -506,6 +506,7 @@ static int create_core_data(struct platform_device *pdev, | |||
506 | 506 | ||
507 | return 0; | 507 | return 0; |
508 | exit_free: | 508 | exit_free: |
509 | pdata->core_data[attr_no] = NULL; | ||
509 | kfree(tdata); | 510 | kfree(tdata); |
510 | return err; | 511 | return err; |
511 | } | 512 | } |