diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2013-02-01 08:28:27 -0500 |
---|---|---|
committer | Matthew Garrett <matthew.garrett@nebula.com> | 2013-02-27 08:30:43 -0500 |
commit | 34cf1df34aba1a6274deeef92ad6d02d5f52dab0 (patch) | |
tree | ea9f8a7db5b603671e245e5e5b53334ef4e09afc /drivers/platform | |
parent | fabf85e3ca15d5b94058f391dac8df870cdd427a (diff) |
sony-laptop: leak in error handling sony_nc_lid_resume_setup()
We need to decrement "i" first because the current "i" was not allocated
succesfully. Also we should go free the way down to zero to avoid a
leak.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 438c7fa999f8..9557414954fa 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -2351,7 +2351,7 @@ static int sony_nc_lid_resume_setup(struct platform_device *pd) | |||
2351 | return 0; | 2351 | return 0; |
2352 | 2352 | ||
2353 | liderror: | 2353 | liderror: |
2354 | for (; i > 0; i--) | 2354 | for (i--; i >= 0; i--) |
2355 | device_remove_file(&pd->dev, &lid_ctl->attrs[i]); | 2355 | device_remove_file(&pd->dev, &lid_ctl->attrs[i]); |
2356 | 2356 | ||
2357 | kfree(lid_ctl); | 2357 | kfree(lid_ctl); |