title: Is free() zeroing out memory?
body: <p>Until today I lived in belief that calling <code>free()</code> on memory space releases it for further allocation without any other modifications. Especially, considering <a href="https://stackoverflow.com/questions/1287180/why-doesnt-free-zero-out-the-memory-prior-to-releasing-it">this SO question</a> that clearly states that <code>free()</code> DOESN'T zero out memory.</p>
  
  <p>Yet, let's consider this piece of code (test.c):</p>
  
  <pre><code>#include&lt;stdlib.h&gt;
  #include&lt;stdio.h&gt;
  
  int main()
  {
      int* pointer;
  
      if (NULL == (pointer = malloc(sizeof(*pointer))))
          return EXIT_FAILURE;
  
      *pointer = 1337;
  
      printf("Before free(): %p, %d\n", pointer, *pointer);
  
      free(pointer);
  
      printf("After free(): %p, %d\n", pointer, *pointer);
  
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>Compiling (both GCC and Clang):</p>
  
  <pre><code>gcc test.c -o test_gcc
  clang test.c -o test_clang
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>$ ./test_gcc 
  Before free(): 0x719010, 1337
  After free(): 0x719010, 0
  $ ./test_clang
  Before free: 0x19d2010, 1337
  After free: 0x19d2010, 0
  </code></pre>
  
  <p>Why is it so? Was I living in a lie all this time or did I misunderstand some basic concepts? Or is there a better explanation?</p>
  
  <p>Some technical info:</p>
  
  <pre><code>Linux 4.0.1-1-ARCH x86_64
  gcc version 4.9.2 20150304 (prerelease) (GCC)
  clang version 3.6.0 (tags/RELEASE_360/final)
  </code></pre>