aboutsummaryrefslogtreecommitdiffstats
path: root/src/defalloc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/defalloc.cpp')
-rw-r--r--src/defalloc.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/defalloc.cpp b/src/defalloc.cpp
index ad54fb3ca..5b61e7fac 100644
--- a/src/defalloc.cpp
+++ b/src/defalloc.cpp
@@ -4,6 +4,7 @@
*************************************************/
#include <botan/defalloc.h>
+#include <botan/libstate.h>
#include <botan/util.h>
#include <cstdlib>
#include <cstring>
@@ -78,4 +79,20 @@ void Locking_Allocator::dealloc_block(void* ptr, u32bit n)
do_free(ptr, n, true);
}
+/*************************************************
+* Get an allocator *
+*************************************************/
+Allocator* Allocator::get(bool locking)
+ {
+ std::string type = "";
+ if(!locking)
+ type = "malloc";
+
+ Allocator* alloc = global_state().get_allocator(type);
+ if(alloc)
+ return alloc;
+
+ throw Exception("Couldn't find an allocator to use in get_allocator");
+ }
+
}