title: Return a string allocated with malloc?
body: <p>I'm creating a function that returns a string. The size of the string is known at runtime, so I'm planning to use <code>malloc()</code>, but I don't want to give the user the responsibility for calling <code>free()</code> after using my function's return value.</p>
  
  <p>How can this be achieved? How do other functions that return strings (<code>char *</code>) work (such as <code>getcwd()</code>, <code>_getcwd()</code>, <code>GetLastError()</code>, <code>SDL_GetError()</code>)?</p>