mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-25 06:00:33 +05:00
0022232: [CEA 837] Memory corruption in GEOM/SMESH that leads to segfault on debian64
Fix "Mismatched free() / delete / delete []" valgrind error - Standard_EXPORT char* GetName(); + Standard_EXPORT TCollection_AsciiString GetName();
This commit is contained in:
parent
e69511781d
commit
1d2e9cb443
@ -314,16 +314,16 @@ void GEOM_Object::SetName(const char* theName)
|
|||||||
* GetName
|
* GetName
|
||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
char* GEOM_Object::GetName()
|
TCollection_AsciiString GEOM_Object::GetName()
|
||||||
{
|
{
|
||||||
|
TCollection_AsciiString aName;
|
||||||
Handle(TDataStd_Name) aNameAttr;
|
Handle(TDataStd_Name) aNameAttr;
|
||||||
if(!_label.FindAttribute(TDataStd_Name::GetID(), aNameAttr)) return NULL;
|
if(_label.FindAttribute(TDataStd_Name::GetID(), aNameAttr))
|
||||||
|
aName = aNameAttr->Get();
|
||||||
TCollection_AsciiString aName(aNameAttr->Get());
|
|
||||||
// do not return pointer of local variable
|
// do not return pointer of local variable
|
||||||
// return aName.ToCString();
|
// return aName.ToCString();
|
||||||
// the following code could lead to memory leak, so take care about recieved pointer
|
// the following code could lead to memory leak, so take care about recieved pointer
|
||||||
return strdup(aName.ToCString());
|
return aName;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -213,7 +213,7 @@ class GEOM_Object : public MMgt_TShared
|
|||||||
Standard_EXPORT void SetName(const char* theName);
|
Standard_EXPORT void SetName(const char* theName);
|
||||||
|
|
||||||
//Returns a name of this GEOM_Object
|
//Returns a name of this GEOM_Object
|
||||||
Standard_EXPORT char* GetName();
|
Standard_EXPORT TCollection_AsciiString GetName();
|
||||||
|
|
||||||
//Sets a color of this GEOM_Object
|
//Sets a color of this GEOM_Object
|
||||||
Standard_EXPORT void SetColor(const Color& theColor);
|
Standard_EXPORT void SetColor(const Color& theColor);
|
||||||
|
Loading…
Reference in New Issue
Block a user