title: Call to malloc, unknown size
body: <p>I am getting the current working directory with _getcwd. The function requires a pointer to the buffer, and the buffers size.</p>
  
  <p>In my code I am using:</p>
  
  <pre><code>char *cwdBuf;
  cwdBuf = malloc(100);
  </code></pre>
  
  <p>I don't know the size of the buffer needed, so I am reserving memory way to big than is needed. What I would like to do is use the correct amount of memory.</p>
  
  <p>Is there any way to do this?</p>