Fixed memory leaks for non-solaris compilers.
This commit is contained in:
parent
0913a51ccd
commit
465555e39d
|
@ -42,7 +42,15 @@ void Check::reportError(const ErrorLogger::ErrorMessage &errmsg)
|
|||
{
|
||||
std::cout << errmsg.toXML(true, 1) << std::endl;
|
||||
}
|
||||
|
||||
std::list<Check *> &Check::instances() {
|
||||
#ifdef __SVR4
|
||||
// Under Solaris, destructors are called in wrong order which causes a segmentation fault.
|
||||
// This fix ensures pointer remains valid and reachable until program terminates.
|
||||
static std::list<Check *> *_instances= new std::list<Check *>;
|
||||
return *_instances;
|
||||
#else
|
||||
static std::list<Check *> _instances;
|
||||
return _instances;
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue