File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -46,16 +46,14 @@ class MemoryPool {
46
46
}
47
47
48
48
~MemoryPool () {
49
- if (_begin)
50
- _allocator->deallocate (_begin);
49
+ deallocPool ();
51
50
}
52
51
53
52
MemoryPool (const MemoryPool&) = delete ;
54
53
MemoryPool& operator =(const MemoryPool& src) = delete ;
55
54
56
55
MemoryPool& operator =(MemoryPool&& src) {
57
- if (_begin)
58
- _allocator->deallocate (_begin);
56
+ deallocPool ();
59
57
_allocator = src._allocator ;
60
58
_begin = src._begin ;
61
59
_end = src._end ;
@@ -265,6 +263,11 @@ class MemoryPool {
265
263
ARDUINOJSON_ASSERT (isAligned (_end));
266
264
}
267
265
266
+ void deallocPool () {
267
+ if (_begin)
268
+ _allocator->deallocate (_begin);
269
+ }
270
+
268
271
Allocator* _allocator;
269
272
char *_begin, *_left, *_right, *_end;
270
273
bool _overflowed;
You can’t perform that action at this time.
0 commit comments