]> pilppa.com Git - libplp.git/commitdiff
Memory leak cleanups.
authorMika Laitio <lamikr@pilppa.org>
Fri, 11 Mar 2011 15:55:58 +0000 (17:55 +0200)
committerMika Laitio <lamikr@pilppa.org>
Fri, 11 Mar 2011 15:55:58 +0000 (17:55 +0200)
Signed-off-by: Mika Laitio <lamikr@pilppa.org>
src/Date.cc
src/Device.cc
src/Device.hh
src/SensorDevice.hh

index 461c9d0022a3274d4ba0e72045362d3a88bf377d..368fafa2c12814e03089af08771ca21a06310793 100644 (file)
@@ -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;
index 96189bc30fb609901b9e835c9834d7cb344bd109..d583f16199dd95670c450608dc3a2dbd603cc338 100644 (file)
@@ -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;
index c165b1c1156e3c8666adb7cdfebf198349967da2..daef2f89d7002c3a2d3b00628c5819a162ac5baa 100644 (file)
@@ -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();
index 1eea03165a57f229ab0527b499c114fab99aa0d8..b6830344bfd516270392c6bc86fc0807e69ec0d5 100644 (file)
@@ -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;
        };