Skip to content

Commit 34cf1df

Browse files
Dan CarpenterMatthew Garrett
authored andcommitted
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 <[email protected]> Signed-off-by: Matthew Garrett <[email protected]>
1 parent fabf85e commit 34cf1df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/platform/x86/sony-laptop.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2351,7 +2351,7 @@ static int sony_nc_lid_resume_setup(struct platform_device *pd)
23512351
return 0;
23522352

23532353
liderror:
2354-
for (; i > 0; i--)
2354+
for (i--; i >= 0; i--)
23552355
device_remove_file(&pd->dev, &lid_ctl->attrs[i]);
23562356

23572357
kfree(lid_ctl);

0 commit comments

Comments
 (0)