From: Alexander <san...@gm...> - 2012-08-01 17:35:41
|
Hello all, Please find below suggested fixes for the memory leak bugs. If you feel they are not quite right, please leave a feedback on that. Thanks. https://sourceforge.net/tracker/?func=detail&aid=2940452&group_id=15190&atid=115190 https://sourceforge.net/tracker/?func=detail&aid=3109495&group_id=15190&atid=115190 Alexander. Patch for 2940452 (releasing allocated static map if it has no elements anymore): *** ../../../log4cpp/src/Appender.cpp 2007-08-02 17:20:26.000000000 +0400 --- ./Appender.cpp 2012-08-01 20:29:09.784099993 +0400 *************** *** 38,43 **** --- 38,46 ---- void Appender::_removeAppender(Appender* appender) { threading::ScopedLock lock(_appenderMapMutex); _getAllAppenders().erase(appender->getName()); + if(_getAllAppenders().size() == 0) { + delete _allAppenders; _allAppenders = 0; + } } Patch for 3109495 (deleting allocated on the heap in the case exception is thrown and caught): *** ../../../log4cpp/src/PropertyConfiguratorImpl.cpp 2003-05-23 02:45:48.000000000 +0400 --- ./PropertyConfiguratorImpl.cpp 2012-08-01 20:39:04.489114799 +0400 *************** *** 268,273 **** --- 268,274 ---- appender->setThreshold(Priority::getPriorityValue(thresholdName)); } } catch(std::invalid_argument& e) { + delete appender; throw ConfigureFailure(std::string(e.what()) + " for threshold of appender '" + appenderName + "'"); } |