[fix](vec) fix coredump for aggregate function when delete large_data, due to alloc-dealloc-mismatch (#8641)

This commit is contained in:
airborne12
2022-03-28 10:17:13 +08:00
committed by GitHub
parent 11f9f5fe4d
commit cdf0a016c3

View File

@ -225,7 +225,7 @@ private:
char small_data[MAX_SMALL_STRING_SIZE]; /// Including the terminating zero.
public:
~SingleValueDataString() { delete large_data; }
~SingleValueDataString() { delete[] large_data; }
bool has() const { return size >= 0; }
@ -242,7 +242,7 @@ public:
if (size != -1) {
size = -1;
capacity = 0;
delete large_data;
delete[] large_data;
large_data = nullptr;
}
}
@ -266,7 +266,7 @@ public:
} else {
if (capacity < rhs_size) {
capacity = static_cast<UInt32>(round_up_to_power_of_two_or_zero(rhs_size));
delete large_data;
delete[] large_data;
large_data = new char[capacity];
}
@ -296,7 +296,7 @@ public:
if (capacity < value_size) {
/// Don't free large_data here.
capacity = round_up_to_power_of_two_or_zero(value_size);
delete large_data;
delete[] large_data;
large_data = new char[capacity];
}