about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDaniel Schemmel <daniel@schemmel.net>2023-05-19 22:29:04 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2023-05-26 21:01:54 +0100
commitc588b9572eb09f00fa4a79340224f44a7bf3bf71 (patch)
tree3f97c078cdccc4092c91daf62009cbaa8828be9a
parent8600ab9be42443487145b6476e0d6be49d055bd2 (diff)
downloadklee-c588b9572eb09f00fa4a79340224f44a7bf3bf71.tar.gz
add unsized free to kdalloc
-rw-r--r--include/klee/KDAlloc/allocator.h14
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!