Skip to content

Commit

Permalink
sony-laptop: leak in error handling sony_nc_lid_resume_setup()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Matthew Garrett committed Feb 27, 2013
1 parent fabf85e commit 34cf1df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/platform/x86/sony-laptop.c
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 34cf1df

Please sign in to comment.