From: Mika Laitio Date: Fri, 11 Mar 2011 15:55:58 +0000 (+0200) Subject: Memory leak cleanups. X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=73fdd5072c55654da0ef06f14762ae2c1a3c739b;p=libplp.git Memory leak cleanups. Signed-off-by: Mika Laitio --- diff --git a/src/Date.cc b/src/Date.cc index 461c9d0..368fafa 100644 --- a/src/Date.cc +++ b/src/Date.cc @@ -365,8 +365,8 @@ string Date::to_sortable_string() { } string Date::to_string() { - char buffer[30]; string ret_val; + char buffer[40]; sprintf(buffer, "%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, min, sec); ret_val = buffer; diff --git a/src/Device.cc b/src/Device.cc index 96189bc..d583f16 100644 --- a/src/Device.cc +++ b/src/Device.cc @@ -4,6 +4,8 @@ * Created on: Mar 4, 2011 * Author: lamikr */ +#include "log.h" + #include "Device.hh" using namespace std; @@ -22,9 +24,9 @@ Device::Device(std::string id_param, std::string type_param, std::string name_pa lifecycle_status = status_param; } -Device::~Device() { - -} +//Device::~Device() { +// log_debug("Device: constructor\n"); +//} string Device::get_id() { return id; diff --git a/src/Device.hh b/src/Device.hh index c165b1c..daef2f8 100644 --- a/src/Device.hh +++ b/src/Device.hh @@ -19,7 +19,7 @@ namespace plp { public: Device(string id_param, string type_param); Device(string id_param, string type_param, string name_param, EnumDeviceLifeCycleStatus status_param); - ~Device(); + virtual ~Device() { } std::string get_id(); std::string get_name(); std::string get_type(); diff --git a/src/SensorDevice.hh b/src/SensorDevice.hh index 1eea031..b683034 100644 --- a/src/SensorDevice.hh +++ b/src/SensorDevice.hh @@ -19,7 +19,8 @@ namespace plp { class SensorDevice : public Device { public: SensorDevice(std::string id_param, std::string type_param) : Device(id_param, type_param) {} - virtual DataReader *get_device_data() = 0; + virtual ~SensorDevice() {} + virtual const DataReader *get_device_data() = 0; virtual string get_unit() = 0; virtual plp::Data *get_data() = 0; };