Skip to content

Commit 880ccc9

Browse files
committed
Correct typo and double dealocator
1 parent bb197b2 commit 880ccc9

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/mfast/coder/common/template_repo.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ class template_repo_base {
1414
template_repo_base(mfast::allocator *dictionary_alloc)
1515
: dictionary_alloc_(dictionary_alloc) {}
1616
virtual ~template_repo_base() {
17-
for (auto &elem : vector_enties_) {
17+
for (auto &elem : vector_entries_) {
1818
if (elem->of_array.capacity_in_bytes_)
19+
{
1920
dictionary_alloc_->deallocate(elem->of_array.content_,
2021
elem->of_array.capacity_in_bytes_);
22+
elem->of_array.capacity_in_bytes_ = 0;
23+
elem->of_array.content_ = nullptr;
24+
}
2125
}
2226
}
2327

@@ -35,15 +39,15 @@ class template_repo_base {
3539
}
3640
void add_vector_entry(value_storage *entry) {
3741
if (dictionary_alloc_)
38-
vector_enties_.push_back(entry);
42+
vector_entries_.push_back(entry);
3943
}
4044

4145
protected:
4246
friend class dictionary_builder;
4347

4448
typedef std::vector<value_storage *> value_entries_t;
4549
value_entries_t reset_entries_;
46-
value_entries_t vector_enties_; // for string and byteVector
50+
value_entries_t vector_entries_; // for string and byteVector
4751
arena_allocator instruction_alloc_;
4852
mfast::allocator *dictionary_alloc_;
4953
};

0 commit comments

Comments
 (0)