title: Using realloc to shrink the allocated memory
body: <p>Simple question about the realloc function in C: 
  If I use realloc to shrink the memory block that a pointer is pointing to, does the "extra" memory get freed? Or does it need to be freed manually somehow?</p>
  
  <p>For example, if I do </p>
  
  <pre><code>int *myPointer = malloc(100*sizeof(int));
  myPointer = realloc(myPointer,50*sizeof(int));
  free(myPointer);
  </code></pre>
  
  <p>Will I have a memory leak?</p>