File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -466,24 +466,17 @@ sample *factory::pop_freelist() {
466
466
}
467
467
468
468
factory::~factory () {
469
- // get pending samples
470
- std::vector<sample*> pending;
471
469
sample *cur = tail_.load ();
472
-
473
- // add them without deleting
474
470
while (cur) {
475
- if (cur != sentinel ()) {
476
- pending.push_back (cur);
477
- }
478
471
sample *next = cur->next_ .load ();
479
- cur = next;
480
- }
481
472
482
- // now delete the samples
483
- for (sample* s : pending) {
484
- delete s;
485
- }
473
+ // Only delete samples that are outside of storage area
474
+ if (cur != sentinel () && ( static_cast < void *>(cur) < storage_ ||
475
+ static_cast < void *>(cur) >= storage_ + storage_size_))
476
+ delete cur;
486
477
478
+ cur = next;
479
+ }
487
480
delete[] storage_;
488
481
}
489
482
You can’t perform that action at this time.
0 commit comments