View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003844 | FreeCAD | Bug | public | 2019-02-17 18:11 | 2019-06-20 13:17 |
Reporter | wmayer | Assigned To | wmayer | ||
Priority | high | Severity | major | Reproducibility | have not tried |
Status | assigned | Resolution | open | ||
Target Version | 0.19 | ||||
Summary | 0003844: PVS: The pointer was not released in destructor. A memory leak is possible. | ||||
Description | At the moment the CommandBase class has a couple of member variables of type const char*. Now the strings passed to the constructor are compiled into the binaries so that in the destructors the memory mustn't be freed. However, there are also setter methods to change the strings and usually the passed arguments have only a tmp. lifetime. So, the method strdup() must be used. However, on destruction time we don't know whether the memory was allocated on the heap or not. To be on the safe side nothing is freed but in case the setter methods have been used we have a major memory leak. So, to solve all the hassles it's best to use std::string as members. This may cause a certain overhead but at least makes sure that all memory is freed. | ||||
Tags | No tags attached. | ||||
FreeCAD Information | |||||
|
General Analysis Command.cpp:742 Medium V773 The 'sScriptName' pointer was not released in destructor. A memory leak is possible. General Analysis Command.cpp:141 Medium V773 The 'sMenuText' pointer was not released in destructor. A memory leak is possible. General Analysis Command.cpp:141 Medium V773 The 'sToolTipText' pointer was not released in destructor. A memory leak is possible. General Analysis Command.cpp:141 Medium V773 The 'sWhatsThis' pointer was not released in destructor. A memory leak is possible. General Analysis Command.cpp:141 Medium V773 The 'sStatusTip' pointer was not released in destructor. A memory leak is possible. General Analysis Command.cpp:141 Medium V773 The 'sPixmap' pointer was not released in destructor. A memory leak is possible. General Analysis Command.cpp:141 Medium V773 The 'sAccel' pointer was not released in destructor. A memory leak is possible. General Analysis Command.cpp:225 Medium V773 The 'sAppModule' pointer was not released in destructor. A memory leak is possible. General Analysis Command.cpp:225 Medium V773 The 'sGroup' pointer was not released in destructor. A memory leak is possible. |