• Alexis SALZMAN's avatar
    [xFEM] add security to avoid potential memory leek in xData · 5d11f62f
    Alexis SALZMAN authored
    One recent commit change 'mesh' data member access of class xData. It is now
    a private member. Two get/set methods were added to access to this pointer.
    But if we read with xData a mesh from a file and choose afterword to  use setMesh
    method to reassign the 'mesh' pointer to a new mesh instance user had to
    pay attention to the way he treat memory allocated done during first read from file.
    If he did want to avoid potential memory leak he had to call the getMesh
    method and with the return pointer free memory, all this before calling setMesh ...
    
    This commit choose to add a state to xData to say if the 'mesh' data
    member point to a memory maintained by xData or not. A new delMesh
    method is then in charge of freeing memory pointed by 'mesh' pointer only if
    this memory was allocated by xData. This function is called in setMesh
    to avoid memory leek. It is also called in destructor to avoid to free memory
    allocated by user (double free error). And it is made public to offer a
    simple way to free memory allocated by xData if any.
    
    Hop this make things more clear to user. For sure it is not ideal for
    thread safety ...
    5d11f62f
Name
Last commit
Last update
Trellis Loading commit data...
xAnalyticalSolution Loading commit data...
xCrack Loading commit data...
xCut Loading commit data...
xDomainDecomp Loading commit data...
xExport Loading commit data...
xExt Loading commit data...
xFEM Loading commit data...
xFastMarching Loading commit data...
xGeom Loading commit data...
xGraph Loading commit data...
xInterface Loading commit data...
xLinAlg Loading commit data...
xMapping Loading commit data...
xMeshTool Loading commit data...
xOctree Loading commit data...
xPhysics Loading commit data...
xQuadrature Loading commit data...
xTLS Loading commit data...
xTensor Loading commit data...
xTool Loading commit data...
xUtil Loading commit data...
.clang-format Loading commit data...
.gitignore Loading commit data...
CMakeLists.txt Loading commit data...
CONTRIBUTING.md Loading commit data...
Ext_dependence.dot Loading commit data...
LICENSE.md Loading commit data...
README.md Loading commit data...
Xfiles_dependence.dot Loading commit data...