title: Deallocate wchar_t* of a vector
body: <p>I have a vector of wchar_t* like this:</p>
  
  <pre><code>std::vector&lt;wchar_t*&gt; myvector;
  </code></pre>
  
  <p>and a function that take a string and insert it into the vector</p>
  
  <pre><code>void myfunction(wchar_t* mystring)
  {
      myvector.push_back(mystring);
  }
  
  myfunction(L"this is my string");
  </code></pre>
  
  <p>when I close the program I need to delete the allocated memory of the vector so that I don't have a memory leak, to do this I'm trying to do this:</p>
  
  <pre><code>for (std::vector&lt;wchar_t*&gt;::iterator it = myvector.begin(); it != myvector.end(); ++it)
  {
      delete [] *it;
  }
  </code></pre>
  
  <p>it compiles, all works fine but when it's time to deallocated the memory I have a rountime error:</p>
  
  <p><a href="http://k.min.us/iklWGE.png" rel="nofollow noreferrer">error http://k.min.us/iklWGE.png</a></p>
  
  <p>why? how can I fix this?</p>