Skip to content

Commit 133ec0d

Browse files
authored
Merge pull request #150 from stlab:fix/string-pool-memory-management
Fix undefined behavior in `string_pool` memory management
2 parents 903b653 + e472044 commit 133ec0d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

source/string_pool.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
#include <vector>
1414

1515
#include <adobe/algorithm/copy.hpp>
16-
#include <adobe/algorithm/for_each.hpp>
1716
#include <adobe/closed_hash.hpp>
18-
#include <adobe/functional.hpp>
1917
#include <adobe/name.hpp>
2018
#include <adobe/string.hpp>
2119

@@ -43,7 +41,11 @@ class string_pool_t : boost::noncopyable {
4341
explicit string_pool_t(std::size_t pool_size = default_pool_size_k)
4442
: pool_size_m(pool_size), next_m(NULL), end_m(NULL) {}
4543

46-
~string_pool_t() { adobe::for_each(pool_m, adobe::delete_ptr()); }
44+
~string_pool_t() {
45+
for (char* pool : pool_m) {
46+
::operator delete(pool);
47+
}
48+
}
4749

4850
const char* add(const char* ident) {
4951
std::size_t n = std::strlen(ident);

0 commit comments

Comments
 (0)