diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-21 13:45:58 +0100 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-21 13:46:31 +0100 |
commit | d42b7240d7cbd8a36b5adfd9a5726302b37a0b0f (patch) | |
tree | 4a4b170b40c1354213863c2300a3838722495208 | |
parent | 8b8afeed2c93791b37b2451e00b73174e2d296c5 (diff) |
Code enhancements mem leaks and uninitialized byte
Change-Id: I40632b6212118278f5877957a480122e9383e3bc
Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r-- | low-can-binding/diagnostic/diagnostic-manager.cpp | 13 | ||||
-rw-r--r-- | low-can-binding/diagnostic/diagnostic-manager.hpp | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/low-can-binding/diagnostic/diagnostic-manager.cpp b/low-can-binding/diagnostic/diagnostic-manager.cpp index 8533503f..0454a7e7 100644 --- a/low-can-binding/diagnostic/diagnostic-manager.cpp +++ b/low-can-binding/diagnostic/diagnostic-manager.cpp @@ -36,6 +36,19 @@ diagnostic_manager_t::diagnostic_manager_t() : initialized_{false} {} + +diagnostic_manager_t::~diagnostic_manager_t() +{ + for(auto r: recurring_requests_) + { + delete(r); + } + for(auto r: non_recurring_requests_) + { + delete(r); + } +} + /// @brief Diagnostic manager isn't initialized at launch but after /// CAN bus devices initialization. For the moment, it is only possible /// to have 1 diagnostic bus which are the first bus declared in the JSON diff --git a/low-can-binding/diagnostic/diagnostic-manager.hpp b/low-can-binding/diagnostic/diagnostic-manager.hpp index b503a06a..1a6ae7e5 100644 --- a/low-can-binding/diagnostic/diagnostic-manager.hpp +++ b/low-can-binding/diagnostic/diagnostic-manager.hpp @@ -59,6 +59,7 @@ private: static void shims_timer(); public: diagnostic_manager_t(); + ~diagnostic_manager_t(); bool initialize(); |