Automatically generated mfc application - memory leaks.

  • Thread starter Thread starter Rarik
  • Start date Start date
R

Rarik

Guest
We created default MFC application with VS 2015.



This application contains automatically generated code.

We do not did our changes in code.

Depends what we will use in application it contains code like:



m_wndRibbonBar.AddToTabs(new CMFCRibbonButton....



or

m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane...



or



// create main MDI Frame window

CMainFrame* pMainFrame = new CMainFrame;



But the code which deletes these pointers was not generated automatically. Why?



Is the delete performed on some hidden level?

Or we have to re-declare these as a private members and add everywhere delete statement them on destroy or destructor?

Can it be left like it is and it will be not memory leaking?



I tried to find the documentation about how to delete them and it was unsuccessful.





The reason we are asking that: we scanned the code using some software (Fortify).



We have Fortify Report scan and it complains: “The function ... in ....cpp allocates memory on line 225 and fails to free it.”



Is it false positive or should be fixed?



Thanks.







Continue reading...
 
Back
Top