title: using free() with a struct pointer makes program crash
body: <p>Error:</p>
  
  <pre><code>*** Error in `./main': free(): invalid next size (fast): 0x080e1008 ***
  Aborted
  </code></pre>
  
  <p>This is my program, and it's crashing when I try to deallocate a struct.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;sys/time.h&gt;
  //struct words contains a word as well as a boolean
  //to check if it was used yet or not.
  struct words
  {
      char * word;
      int bool;
  };
  //the main function in which everything happens.
  //the controller, if you will.
  int main()
  {
      struct words * word_library = malloc(9);
      struct timeval start, end;
      free(word_library);
      return 0;
  }
  </code></pre>
  
  <p>So this is the code making my program crash:</p>
  
  <p>free(word_library);</p>
  
  <p>What is causing it to crash? And how can prevent this in the future? I know that every use of malloc() requires the free() after to deallocate it. But when I don't use free() it ends just fine, but I'm sure there's a memory leak.</p>