Stop leaking the mark pools.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 16 Apr 2013 20:38:09 +0000 (22:38 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 16 Apr 2013 20:38:09 +0000 (22:38 +0200)
main.cpp

index be3e8eb..9514270 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -32,6 +32,7 @@ using namespace std;
 
 AccessLogThread *access_log = NULL;
 ServerPool *servers = NULL;
+vector<MarkPool *> mark_pools;
 volatile bool hupped = false;
 volatile bool stopped = false;
 
@@ -142,7 +143,6 @@ void create_streams(const Config &config,
                     const set<string> &deserialized_stream_ids,
                    map<string, Input *> *deserialized_inputs)
 {
-       vector<MarkPool *> mark_pools;  // FIXME: leak
        for (unsigned i = 0; i < config.mark_pools.size(); ++i) {
                const MarkPoolConfig &mp_config = config.mark_pools[i];
                mark_pools.push_back(new MarkPool(mp_config.from, mp_config.to));
@@ -430,6 +430,12 @@ start:
                }
        }
        delete servers;
+
+       for (unsigned i = 0; i < mark_pools.size(); ++i) {
+               delete mark_pools[i];
+       }
+       mark_pools.clear();
+
        access_log->stop();
        delete access_log;
        shut_down_logging();