C++ Struct initialisation problem
<p>This c++ code is working fine , however memory validator says that I am using a deleted pointer in: 
grf->filePath = fname; Do you have any idea why ? Thank you.</p>

<p>Dirloader.h</p>

<pre><code>  // Other code  
  class CDirLoader  
    {
    public:    
     struct TKnownGRF
     {
      std::string filePath;
      DWORD encodingType;
      DWORD userDataLen;
      char *userData;
     };
       // Other Code

     CDirLoader();
     virtual ~CDirLoader();
</code></pre>

<p>Dirloader.cpp</p>

<pre><code>// Other code
void CDirLoader::AddGroupFile(const std::string&amp; _fname)
{
// Other code including std::string fname = _fname;
TKnownGRF *grf = new TKnownGRF;
grf-&gt;filePath = fname;
delete grf; // Just for testing purposes
</code></pre>

<p>P.S.: This is only an code extract. Of course if I define a struct TKnownGRF inside .cpp and use it as an actual object, gfr.filepath = something, instead of pointer grf->filepath=something, than it is ok, but I do need to have it inside *.h in CDirLoader class, due to many other vector allocations.</p>
