title: valgrind Address 0x421688c is 0 bytes after a block of size 4 alloc'd for linked list having integer data
body: <p>Although there were multiple threads related to</p>
  
  <blockquote>
    <p>valgrind Address 0x421688c is 0 bytes after a block of size 4 alloc'd</p>
  </blockquote>
  
  <p>kind of questions, but all were expressed with either strlen, or '\0' related issues and I understand them. I am having with linked list insertion dealing with integers.</p>
  
  <pre><code>void insert_node(lnode **head, int num){
      lnode *temp = NULL;
  
      temp = calloc(1, sizeof(lnode *));
      if(temp == NULL){
          printf("Memory Allocation failed!\n");
          return;
      }   
      temp-&gt;data = num;
      temp-&gt;next = NULL;
  
      if(*head == NULL){
          *head = temp;
      }   
      else{
          temp-&gt;next = *head;
          *head = temp;
      }   
  }
  </code></pre>
  
  <p>I did insertion, deletion steps and get summary(showing last few lines of valgrind errors as the errors are at the same place):</p>
  
  <pre><code>    &gt; ==3238== 9 errors in context 5 of 5:
      &gt; ==3238== Invalid read of size 4
      &gt; ==3238==    at 0x804873D: display (in /home/skb/santosh_practice/linked_list_progs/single_LL/a.out)
      &gt; ==3238==    by 0x8048636: main (in /home/skb/santosh_practice/linked_list_progs/single_LL/a.out)
      &gt; ==3238==  Address 0x42168fc is 0 bytes after a block of size 4 alloc'd
      &gt; ==3238==    at 0x402C17C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
      &gt; ==3238==    by 0x8048686: insert_node (in /home/skb/santosh_practice/linked_list_progs/single_LL/a.out)
      &gt; ==3238==    by 0x8048614: main (in /home/skb/santosh_practice/linked_list_progs/single_LL/a.out)
      &gt; ==3238== 
      &gt; ==3238== ERROR
  ERROR SUMMARY: 22 errors from 5 contexts (suppressed: 0 from 0)
  </code></pre>
  
  <p>Please tell me where I am doing wrong?</p>