From: Amit Choudhary <amit2030@gmail.com>
To: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] [RESEND] include/linux/slab.h: new KFREE() macro.
Date: Mon, 1 Jan 2007 13:53:47 -0800 [thread overview]
Message-ID: <20070101135347.b036d473.amit2030@gmail.com> (raw)
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.
reply other threads:[~2007-01-01 21:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070101135347.b036d473.amit2030@gmail.com \
--to=amit2030@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox