]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
sony-laptop: leak in error handling sony_nc_lid_resume_setup()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 1 Feb 2013 13:28:27 +0000 (16:28 +0300)
committerMatthew Garrett <matthew.garrett@nebula.com>
Wed, 27 Feb 2013 13:30:43 +0000 (08:30 -0500)
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>
drivers/platform/x86/sony-laptop.c

index 438c7fa999f845b7bb8515eac7b3c35862ce528d..9557414954fab0163956c85be6a65c3ec6f59609 100644 (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);