diff options
-rw-r--r-- | include/klee/KDAlloc/allocator.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/klee/KDAlloc/allocator.h b/include/klee/KDAlloc/allocator.h index 1e0d305a..4ed76705 100644 --- a/include/klee/KDAlloc/allocator.h +++ b/include/klee/KDAlloc/allocator.h @@ -143,6 +143,20 @@ public: return result; } + void free(void *ptr) { + assert(*this && "Invalid allocator"); + assert(ptr && "Freeing nullptrs is not supported"); // we are not ::free! + + auto bin = control->convertPtrToBinIndex(ptr); + traceLine("Freeing ", ptr, " in bin ", bin); + + if (bin < static_cast<int>(sizedBins.size())) { + return sizedBins[bin].deallocate(control->sizedBins[bin], ptr); + } else { + return largeObjectBin.deallocate(control->largeObjectBin, ptr); + } + } + void free(void *ptr, std::size_t size) { assert(*this && "Invalid allocator"); assert(ptr && "Freeing nullptrs is not supported"); // we are not ::free! |