From: Pekka Enberg <[email-masked]>

This patch introduces a memory-leak tracking version of kzalloc for ALSA.

Signed-off-by: Pekka Enberg <[email-masked]>
Cc: Jaroslav Kysela <[email-masked]>
Signed-off-by: Andrew Morton <[email-masked]>
---

 include/sound/core.h |    2 ++
 sound/core/memory.c  |   13 +++++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff -puN include/sound/core.h~alsa-convert-kcalloc-to-kzalloc include/sound/core.h
--- devel/include/sound/core.h~alsa-convert-kcalloc-to-kzalloc	2005-08-06 14:35:21.000000000 -0700
+++ devel-akpm/include/sound/core.h	2005-08-06 14:35:21.000000000 -0700
@@ -291,12 +291,14 @@ void snd_memory_done(void);
 int snd_memory_info_init(void);
 int snd_memory_info_done(void);
 void *snd_hidden_kmalloc(size_t size, unsigned int __nocast flags);
+void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags);
 void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags);
 void snd_hidden_kfree(const void *obj);
 void *snd_hidden_vmalloc(unsigned long size);
 void snd_hidden_vfree(void *obj);
 char *snd_hidden_kstrdup(const char *s, unsigned int __nocast flags);
 #define kmalloc(size, flags) snd_hidden_kmalloc(size, flags)
+#define kzalloc(size, flags) snd_hidden_kzalloc(size, flags)
 #define kcalloc(n, size, flags) snd_hidden_kcalloc(n, size, flags)
 #define kfree(obj) snd_hidden_kfree(obj)
 #define vmalloc(size) snd_hidden_vmalloc(size)
diff -puN sound/core/memory.c~alsa-convert-kcalloc-to-kzalloc sound/core/memory.c
--- devel/sound/core/memory.c~alsa-convert-kcalloc-to-kzalloc	2005-08-06 14:35:21.000000000 -0700
+++ devel-akpm/sound/core/memory.c	2005-08-06 14:35:21.000000000 -0700
@@ -116,15 +116,20 @@ void *snd_hidden_kmalloc(size_t size, un
 	return _snd_kmalloc(size, flags);
 }
 
+void *snd_hidden_kzalloc(size_t size, unsigned int __nocast flags)
+{
+	void *ret = _snd_kmalloc(size, flags);
+	if (ret)
+		memset(ret, 0, size);
+	return ret;
+}
+
 void *snd_hidden_kcalloc(size_t n, size_t size, unsigned int __nocast flags)
 {
 	void *ret = NULL;
 	if (n != 0 && size > INT_MAX / n)
 		return ret;
-	ret = _snd_kmalloc(n * size, flags);
-	if (ret)
-		memset(ret, 0, n * size);
-	return ret;
+	return snd_hidden_kzalloc(n * size, flags);
 }
 
 void snd_hidden_kfree(const void *obj)
_