Skip to content

Commit

Permalink
fix memory leak of vector type (#692)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Chi <iskyzh@gmail.com>
Co-authored-by: arcsin2 <3295861919@qq.com>
  • Loading branch information
skyzh and UnpureRationalist authored Feb 10, 2024
1 parent bd62db0 commit 905ba77
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/type/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Value::Value(const Value &other) {
value_ = other.value_;
switch (type_id_) {
case TypeId::VARCHAR:
case TypeId::VECTOR:
if (size_.len_ == BUSTUB_VALUE_NULL) {
value_.varlen_ = nullptr;
} else {
Expand Down Expand Up @@ -278,6 +279,7 @@ Value::Value(TypeId type, const std::vector<double> &data) : Value(type) {
Value::~Value() {
switch (type_id_) {
case TypeId::VARCHAR:
case TypeId::VECTOR:
if (manage_data_) {
delete[] value_.varlen_;
}
Expand Down

0 comments on commit 905ba77

Please # to comment.