title: Should the memory allocated by wcsdup be freed explicitly?
body: <p>Functions like <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/wcsdup.html" rel="nofollow">wcsdup</a>, implicitly calls malloc to allocate memory for the destination buffer. I was wondering as the memory allocation is not very explicit, so does it seems logical to explicitly free the storage? 
  This is more like a design dilemma and the reasons for and against are as follows</p>
  
  <p><strong>Should be freed because</strong></p>
  
  <ol>
  <li>Not freeing it would cause Memory Leak.</li>
  <li>It is well documented that wcsdup/_wcsdup calls malloc to allocate memory even when its called from a C++ Program.</li>
  </ol>
  
  <p><strong>Should not be freed because</strong></p>
  
  <ol>
  <li>Memory accumulated by wcsdup would eventually be freed when program exits. We always live with some memory leaks through out the program lifetime(Unless we are heavily calling wcsdup for large buffer size).</li>
  <li>It can be confusing as free was not preceded by an explicit malloc. </li>
  <li>As its not part of the standard but posix compliant, Microsoft implementation may not use malloc for allocating destination buffer.</li>
  </ol>
  
  <p>What should be the approach?</p>