Commit 69461034 authored by Hans Verkuil's avatar Hans Verkuil Committed by Greg Kroah-Hartman

V4L: wm8775/wm8739: Fix memory leak when unloading module

State struct was never freed.

(cherry picked from commit 1b2232ab)
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent e4d69788
...@@ -321,12 +321,14 @@ static int wm8739_probe(struct i2c_adapter *adapter) ...@@ -321,12 +321,14 @@ static int wm8739_probe(struct i2c_adapter *adapter)
static int wm8739_detach(struct i2c_client *client) static int wm8739_detach(struct i2c_client *client)
{ {
struct wm8739_state *state = i2c_get_clientdata(client);
int err; int err;
err = i2c_detach_client(client); err = i2c_detach_client(client);
if (err) if (err)
return err; return err;
kfree(state);
kfree(client); kfree(client);
return 0; return 0;
} }
......
...@@ -222,12 +222,14 @@ static int wm8775_probe(struct i2c_adapter *adapter) ...@@ -222,12 +222,14 @@ static int wm8775_probe(struct i2c_adapter *adapter)
static int wm8775_detach(struct i2c_client *client) static int wm8775_detach(struct i2c_client *client)
{ {
struct wm8775_state *state = i2c_get_clientdata(client);
int err; int err;
err = i2c_detach_client(client); err = i2c_detach_client(client);
if (err) { if (err) {
return err; return err;
} }
kfree(state);
kfree(client); kfree(client);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment