[PATCH 11/12] wm8978: fix a memory leak if another WM8978 is registered

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



wm8978 is allocated in wm8978_i2c_probe() but is not freed if wm8978_register()
return -EINVAL (if another WM8978 is registered).

Signed-off-by: Axel Lin <axel.lin@xxxxxxxxx>
---
 sound/soc/codecs/wm8978.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index 51d5f43..4e80323 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -1007,7 +1007,8 @@ static __devinit int wm8978_register(struct wm8978_priv *wm8978)
 
 	if (wm8978_codec) {
 		dev_err(codec->dev, "Another WM8978 is registered\n");
-		return -EINVAL;
+		ret = -EINVAL;
+		goto err;
 	}
 
 	/*
-- 
1.5.4.3



_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux