title: What does "pointer being freed was not allocated" mean exactly?
body: <p>I have trouble with a program where im trying to copy a string to a structs string variable in c. After copying the string im trying to free the temporary string variable which is copied to the structs string variable. But when i try to free the string the program turns on me and says that "pointer being freed was not allocated". I don't understand exactly what is going on. </p>
  
  <pre><code>char str[]="       ";           //temporary string to copy to structs string
  str[3]=s;                       //putting a char s in middle
  strcpy(matrix[i-1][j].c, str);  //copying the string
  free(str);                      //freeing str that now is useless when copied
  </code></pre>