[2.6.20.17 review 17/58] V4L: wm8775/wm8739: Fix memory leak when unloading module

Willy Tarreau
2007-08-22T08:58:11Z

[-- Attachment #1: 0017-V4L-wm8775-wm8739-Fix-memory-leak-when-unloading-m.patch --]
[-- Type: text/plain, Size: 1487 bytes --]

State struct was never freed.

(cherry picked from commit 1b2232ab879993fcf5b9391c3febf6ab5d78201e)

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Willy Tarreau <w@1wt.eu>
---
drivers/media/video/wm8739.c | 2 ++
drivers/media/video/wm8775.c | 2 ++
2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/wm8739.c b/drivers/media/video/wm8739.c
index a9b59c3..009941b 100644
--- a/drivers/media/video/wm8739.c
+++ b/drivers/media/video/wm8739.c
@@ -317,12 +317,14 @@ static int wm8739_probe(struct i2c_adapter *adapter)

static int wm8739_detach(struct i2c_client *client)
{
+ struct wm8739_state *state = i2c_get_clientdata(client);
int err;

err = i2c_detach_client(client);
if (err)
return err;

+ kfree(state);
kfree(client);
return 0;
}
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c
index d81a88b..e555b3a 100644
--- a/drivers/media/video/wm8775.c
+++ b/drivers/media/video/wm8775.c
@@ -218,12 +218,14 @@ static int wm8775_probe(struct i2c_adapter *adapter)

static int wm8775_detach(struct i2c_client *client)
{
+ struct wm8775_state *state = i2c_get_clientdata(client);
int err;

err = i2c_detach_client(client);
if (err) {
return err;
}
+ kfree(state);
kfree(client);

return 0;
--
1.5.2.5

--