Skip to contentSkip to conversation

include/linux/slab.h: new KFREE() macro.

PATCH RESEND New Amit Choudhary 1 participant 1 message Jan 1, 2007 Slab allocator

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 include/linux/slab.h: new KFREE() macro.

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

include/linux/slab.h +6 -0
index 1ef822e..28da74c 100644
@@ -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.