auxdisplay: fix use after free in lcd2s_i2c_remove()

The kfree() needs to be moved down a line to prevent a use after free.

Fixes: 8c9108d014 ("auxdisplay: add a driver for lcd2s character display")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
Dan Carpenter 2020-11-06 22:24:15 +03:00 committed by Miguel Ojeda
parent ffdf726db7
commit 2cfd72f81c
1 changed files with 1 additions and 1 deletions

View File

@ -348,8 +348,8 @@ static int lcd2s_i2c_remove(struct i2c_client *i2c)
{
struct lcd2s_data *lcd2s = i2c_get_clientdata(i2c);
kfree(lcd2s->charlcd);
charlcd_unregister(lcd2s->charlcd);
kfree(lcd2s->charlcd);
return 0;
}