From 9efdfcdf1fb2299798a6c8f81592f6119a82ae96 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Sat, 19 Oct 2002 15:49:40 +0000 Subject: [PATCH] Add destroying of sections in the config destructor. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@351 --- src/misc/setup.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/misc/setup.cpp b/src/misc/setup.cpp index 33c14ed9..eadee807 100644 --- a/src/misc/setup.cpp +++ b/src/misc/setup.cpp @@ -196,10 +196,19 @@ Section_line* Config::AddSection_line(const char* _name,void (*_initfunction)(Se void Config::Init(){ for (it tel=sectionlist.begin(); tel!=sectionlist.end(); tel++){ + LOG_DEBUG("Init %s",(*tel)->sectionname.c_str()); (*tel)->ExecuteInit(); } } +Config::~Config() { + reverse_it cnt=sectionlist.rbegin(); + while (cnt!=sectionlist.rend()) { + delete (*cnt); + cnt++; + } +} + Section* Config::GetSection(const char* _sectionname){ for (it tel=sectionlist.begin(); tel!=sectionlist.end(); tel++){ if ( (*tel)->sectionname==_sectionname) return (*tel); @@ -248,9 +257,6 @@ void Config::StartUp(void) { (*_start_function)(); } - - - bool CommandLine::FindExist(char * name,bool remove) { cmd_it it; if (!(FindEntry(name,it,false))) return false;