Problem
Application::loadConfiguration() creates a circular reference when loading .properties files:
_pConfig->add(new PropertyFileConfiguration(confPath.toString(),
AbstractConfiguration::Ptr(_pConfig, true)), priority, false);
_pConfig (LayeredConfiguration) owns the PropertyFileConfiguration, and the PropertyFileConfiguration holds _pParentConfig (an AutoPtr) back to the same LayeredConfiguration. This cycle prevents proper cleanup — detected as indirect memory leaks by AddressSanitizer.
The AbstractConfiguration::Ptr(_pConfig, true) with shared=true skips duplicate() on construction but still calls release() on destruction, causing ref count issues on top of the cycle.
Fix
Change PropertyFileConfiguration's parent config parameter and member from AbstractConfiguration::Ptr (owning smart pointer) to AbstractConfiguration* (non-owning raw pointer). The parent configuration always outlives the child — LayeredConfiguration owns the PropertyFileConfiguration, so the back-pointer is guaranteed valid for the child's lifetime.
Affected code
Util/include/Poco/Util/PropertyFileConfiguration.h — constructor parameters and member type changed to raw pointer, with ownership documentation
Util/src/PropertyFileConfiguration.cpp — constructors updated to match
Util/src/Application.cpp — callers pass _pConfig.get() instead of creating a temporary `AutoPtr
Problem
Application::loadConfiguration()creates a circular reference when loading.propertiesfiles:_pConfig(LayeredConfiguration) owns thePropertyFileConfiguration, and thePropertyFileConfigurationholds_pParentConfig(anAutoPtr) back to the sameLayeredConfiguration. This cycle prevents proper cleanup — detected as indirect memory leaks by AddressSanitizer.The
AbstractConfiguration::Ptr(_pConfig, true)withshared=trueskipsduplicate()on construction but still callsrelease()on destruction, causing ref count issues on top of the cycle.Fix
Change
PropertyFileConfiguration's parent config parameter and member fromAbstractConfiguration::Ptr(owning smart pointer) toAbstractConfiguration*(non-owning raw pointer). The parent configuration always outlives the child —LayeredConfigurationowns thePropertyFileConfiguration, so the back-pointer is guaranteed valid for the child's lifetime.Affected code
Util/include/Poco/Util/PropertyFileConfiguration.h— constructor parameters and member type changed to raw pointer, with ownership documentationUtil/src/PropertyFileConfiguration.cpp— constructors updated to matchUtil/src/Application.cpp— callers pass_pConfig.get()instead of creating a temporary `AutoPtr