lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 16 Jul 2010 17:26:48 +0800
From:	Axel Lin <axel.lin@...il.com>
To:	linux-kernel <linux-kernel@...r.kernel.org>
Cc:	Liam Girdwood <lrg@...mlogic.co.uk>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.de>,
	Margarita Olaya Cabrera <magi.olaya@...com>,
	Jorge Eduardo Candelaria <jorge.candelaria@...com>,
	alsa-devel@...a-project.org
Subject: [PATCH] twl6040: fix wrong kfree in twl6040_remove and
	twl6040_codec_remove

Memory allocation part:
We allocate a memory in twl6040_codec_probe():
        priv = kzalloc(sizeof(struct twl6040_data), GFP_KERNEL);
        twl6040_codec = codec = &priv->codec;

Memory release part:
In twl6040_codec_remove() we should kfree(priv) instead of kfree(twl6040_codec).
In twl6040_remove(), no need and should not kfree(codec).

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

diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index af36346..9d4a85f 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -1068,7 +1068,6 @@ static int twl6040_remove(struct platform_device *pdev)
 	twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF);
 	snd_soc_free_pcms(socdev);
 	snd_soc_dapm_free(socdev);
-	kfree(codec);
 
 	return 0;
 }
@@ -1214,7 +1213,7 @@ static int __devexit twl6040_codec_remove(struct platform_device *pdev)
 	snd_soc_unregister_dai(&twl6040_dai);
 	snd_soc_unregister_codec(twl6040_codec);
 
-	kfree(twl6040_codec);
+	kfree(priv);
 	twl6040_codec = NULL;
 
 	return 0;
-- 
1.5.4.3



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ