title: segfault when freeing a pointer during string reversing in C
body: <pre><code>int main(int argc, char **argv){
      char *str = argv[1];
      size_t len = strlen(str);
      char *dst = calloc(len+1, sizeof(char));
      int i;
      for(i=len-1; i&gt;=0; i--){
          memcpy(dst, str+i, 1);
          dst++;
      }
      *(++dst) = '\0';
      printf("%s\n", dst);
      free(dst);
      return 0;
  }
  </code></pre>
  
  <p><em>Error checking omitted for more readability</em><br>
  I don't understand why i got a segfault with this message: "glibc free(): invalid pointer:"<br>
  I'm trying to write a small program that reverse a string using pointers but:<br>
  1) the last printf print nothing;<br>
  2) i got a segfault</p>