History

TimeSeriesPlatformLibrary: Made sure free DataRow values before updating them.

J. Ritchie Carroll committed 7 years ago

Commit 6955f7c1 parent 3e93bb22 files · +19 −4Browse files

Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Data/DataRow.cpp (1 of 2 files). Show all

Unified · Split

Source/Libraries/TimeSeriesPlatformLibrary/Data/DataRow.cpp+17−2
@@ -328,10 +328,10 @@ Object DataRow::GetComputedValue(const DataColumnPtr& column, DataType targetTyp · 327 unmodified lines
328328 case DataType::String:
329329 return value;
330330 case DataType::Boolean:
331− if (IsEqual(value, "true") || IsEqual(value, "1"))
331+ if (IsEqual(value, "true") || IsEqual(value, "1", false))
332332 return true;
333333
334− if (IsEqual(value, "false") || IsEqual(value, "0"))
334+ if (IsEqual(value, "false") || IsEqual(value, "0", false))
335335 return false;
336336
337337 throw DataSetException("Cannot convert \"String\" expression value \"" + value + "\" to \"Boolean\" column");
@@ -463,6 +463,9 @@ void DataRow::SetValue(int32_t columnIndex, const Nullable<T>& value, DataType t · 125 unmodified lines
463463 {
464464 ValidateColumnType(columnIndex, targetType);
465465
466+ // Free any existing value on updates
467+ free(m_values[columnIndex]);
468+
466469 if (value.HasValue())
467470 {
468471 uint8_t* copy = static_cast<uint8_t*>(malloc(sizeof(T)));
@@ -571,6 +574,9 @@ void DataRow::SetStringValue(int32_t columnIndex, const Nullable<string>& value) · 102 unmodified lines
571574 {
572575 ValidateColumnType(columnIndex, DataType::String);
573576
577+ // Free any existing value on updates
578+ free(m_values[columnIndex]);
579+
574580 if (value.HasValue())
575581 {
576582 const string& strval = value.GetValueOrDefault();
@@ -614,6 +620,9 @@ void DataRow::SetBooleanValue(int32_t columnIndex, const Nullable<bool>& value) · 37 unmodified lines
614620 {
615621 ValidateColumnType(columnIndex, DataType::Boolean);
616622
623+ // Free any existing value on updates
624+ free(m_values[columnIndex]);
625+
617626 if (value.HasValue())
618627 {
619628 uint8_t* copy = static_cast<uint8_t*>(malloc(1));
@@ -715,6 +724,9 @@ void DataRow::SetDecimalValue(int32_t columnIndex, const Nullable<decimal_t>& va · 95 unmodified lines
715724 {
716725 ValidateColumnType(columnIndex, DataType::Decimal);
717726
727+ // Free any existing value on updates
728+ free(m_values[columnIndex]);
729+
718730 if (value.HasValue())
719731 {
720732 // The boost decimal type has a very complex internal representation,
@@ -764,6 +776,9 @@ void DataRow::SetGuidValue(int32_t columnIndex, const Nullable<GSF::Guid>& value · 43 unmodified lines
764776 {
765777 ValidateColumnType(columnIndex, DataType::Guid);
766778
779+ // Free any existing value on updates
780+ free(m_values[columnIndex]);
781+
767782 if (value.HasValue())
768783 {
769784 int8_t* copy = static_cast<int8_t*>(malloc(16));

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t