From ee3bd3d4adbe1408f0ae517b483daf67f1e07287 Mon Sep 17 00:00:00 2001 From: Peter Nelson Date: Tue, 26 Jan 2010 19:04:21 +0000 Subject: [PATCH] Clean up memory on exit --- cvbase.h | 5 ----- cvin.cpp | 10 ++++++++++ cvin.h | 1 + cvout.cpp | 10 ++++++++++ cvout.h | 1 + 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/cvbase.h b/cvbase.h index ac1ded7..8c528b4 100644 --- a/cvbase.h +++ b/cvbase.h @@ -25,11 +25,6 @@ public: bool find(const char *name) const; - void stop() - { - close(); - } - void set_name(const char *name) { m_config_name = name; diff --git a/cvin.cpp b/cvin.cpp index bf4caad..18300ab 100644 --- a/cvin.cpp +++ b/cvin.cpp @@ -119,3 +119,13 @@ void CVIn::start() m_it_begin = it_begin; m_ready = true; } + +void CVIn::stop() +{ + if (m_mapping_list.size() == 0) return; + + close(); + + delete [] m_ports; + delete [] m_buffers; +} diff --git a/cvin.h b/cvin.h index 013bf60..bc9c8f9 100644 --- a/cvin.h +++ b/cvin.h @@ -13,6 +13,7 @@ private: public: void start(); + void stop(); }; #endif // CVIN_H diff --git a/cvout.cpp b/cvout.cpp index a704c14..91fce03 100644 --- a/cvout.cpp +++ b/cvout.cpp @@ -145,3 +145,13 @@ void CVOut::start() m_it_begin = it_begin; m_ready = true; } + +void CVOut::stop() +{ + if (m_mapping_list.size() == 0) return; + + close(); + + delete [] m_ports; + delete [] m_buffers; +} diff --git a/cvout.h b/cvout.h index 9b41e2e..ac527af 100644 --- a/cvout.h +++ b/cvout.h @@ -19,6 +19,7 @@ private: public: void start(); + void stop(); }; #endif // CVOUT_H