All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [RESEND] include/linux/slab.h: new KFREE() macro.
@ 2007-01-01 21:53 Amit Choudhary
  0 siblings, 0 replies; only message in thread
From: Amit Choudhary @ 2007-01-01 21:53 UTC (permalink / raw)
  To: Linux Kernel

Description: new KFREE() macro to set the variable NULL after freeing it.

Signed-off-by: Amit Choudhary <amit2030@gmail.com>

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 1ef822e..28da74c 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -75,6 +75,12 @@ void *__kzalloc(size_t, gfp_t);
 void kfree(const void *);
 unsigned int ksize(const void *);
 
+#define KFREE(x)		\
+	do {			\
+		kfree(x);	\
+		x = NULL;	\
+	} while(0)
+
 /**
  * kcalloc - allocate memory for an array. The memory is set to zero.
  * @n: number of elements.

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-01 21:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-01 21:53 [PATCH] [RESEND] include/linux/slab.h: new KFREE() macro Amit Choudhary

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.