View Issue Details

IDProjectCategoryView StatusLast Update
0003844FreeCADBugpublic2019-06-20 13:17
Reporterwmayer Assigned Towmayer  
PriorityhighSeveritymajorReproducibilityhave not tried
Status assignedResolutionopen 
Product Version 
Target Version0.19Fixed in Version 
Summary0003844: PVS: The pointer was not released in destructor. A memory leak is possible.
DescriptionAt 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.
TagsNo tags attached.
FreeCAD Information

Relationships

related to 0003993 closedwmayer Memory leak with Python3 

Activities

wmayer

2019-02-17 18:13

administrator   ~0012672

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.

Issue History

Date Modified Username Field Change
2019-02-17 18:11 wmayer New Issue
2019-02-17 18:11 wmayer Status new => assigned
2019-02-17 18:11 wmayer Assigned To => wmayer
2019-02-17 18:13 wmayer Note Added: 0012672
2019-06-20 13:17 Kunda1 Relationship added related to 0003993