title: does it lead to memory leak?
body: <p>I wrote this code:</p>
  
  <pre><code>string getWinTitle(HWND hwnd){
  const int MAX_LENGTH = 1000;
  wchar_t title[MAX_LENGTH];
  ZeroMemory(title, MAX_LENGTH);
  GetWindowText(hwnd, (LPWSTR)title, MAX_LENGTH);
  char* buffer = new char[MAX_LENGTH];
  wcstombs(buffer, title, MAX_LENGTH);
  string res = buffer;
  return res;
  }
  </code></pre>
  
  <p>is there a memory leak here?
  do I need to free memory allocated by ZeroMemory?
  do I need to explicitly free memory allocated for buffer?</p>
  
  <p>Thank you </p>