diff options
Diffstat (limited to 'fru_area.cpp')
-rw-r--r-- | fru_area.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/fru_area.cpp b/fru_area.cpp index b5d8960..45d4008 100644 --- a/fru_area.cpp +++ b/fru_area.cpp @@ -49,9 +49,8 @@ IPMIFruArea::IPMIFruArea(const uint8_t fruID, const ipmi_fru_area_type type, //----------------------------------------------------- void IPMIFruArea::setData(const uint8_t* value, const size_t length) { - len = length; - data = new uint8_t[len]; - std::memcpy(data, value, len); + data.reserve(length); // pre-allocate the space. + data.insert(data.begin(), value, value + length); } //----------------------------------------------------- @@ -70,9 +69,4 @@ void IPMIFruArea::updateDbusPaths(const char* bus, const char* path, //------------------- IPMIFruArea::~IPMIFruArea() { - if (data != NULL) - { - delete[] data; - data = NULL; - } } |