1
0
Fork 0

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>
hifive-unleashed-5.1
Dan Carpenter 2013-02-01 16:28:27 +03:00 committed by Matthew Garrett
parent fabf85e3ca
commit 34cf1df34a
1 changed files with 1 additions and 1 deletions

View File

@ -2351,7 +2351,7 @@ static int sony_nc_lid_resume_setup(struct platform_device *pd)
return 0;
liderror:
for (; i > 0; i--)
for (i--; i >= 0; i--)
device_remove_file(&pd->dev, &lid_ctl->attrs[i]);
kfree(lid_ctl);