title: How to free memory in the kernel
body: <p>I have the following lines of code in a kernel module. The KFREE line causes The OS to hang. Without it KEDR reports a memory leak. So how do I free p?</p>
  
  <pre><code>char * p = KMALLOC(100, GFP_ATOMIC);
  p = dentry_path_raw(dentry, p, 100) ;
  printk(KERN_EMERG " %s" , p);
  KFREE(p);
  </code></pre>
  
  <p>KFREE is defined as follows:</p>
  
  <pre><code># define KFREE(a)   kfree((a))
  </code></pre>
  
  <p>KMALLOC is defined as follows:</p>
  
  <pre><code># define KMALLOC(a,b)   kmalloc((a),(b))
  </code></pre>