aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wmem/wmem_core.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2012-12-28 17:04:23 +0000
committerEvan Huus <eapache@gmail.com>2012-12-28 17:04:23 +0000
commit0c66691b92668caaf51aac05a8c30f85867571db (patch)
tree6974bd38d86ef7872d29d860b8d94b110e725325 /epan/wmem/wmem_core.c
parent5588d07faae0f3f07ad18f2b3c8586528b28361b (diff)
Add a strict allocator that does canaries and various other things, for
platforms which don't have Valgrind. Valgrind is still the better choice on platforms which support it. svn path=/trunk/; revision=46828
Diffstat (limited to 'epan/wmem/wmem_core.c')
-rw-r--r--epan/wmem/wmem_core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/epan/wmem/wmem_core.c b/epan/wmem/wmem_core.c
index 5a05332c56..0311ce0a6d 100644
--- a/epan/wmem/wmem_core.c
+++ b/epan/wmem/wmem_core.c
@@ -32,6 +32,7 @@
#include "wmem_allocator.h"
#include "wmem_allocator_simple.h"
#include "wmem_allocator_block.h"
+#include "wmem_allocator_strict.h"
void *
wmem_alloc(wmem_allocator_t *allocator, const size_t size)
@@ -84,6 +85,9 @@ wmem_allocator_new(const wmem_allocator_type_t type)
else if (strncmp(override, "block", strlen("block")) == 0) {
real_type = WMEM_ALLOCATOR_BLOCK;
}
+ else if (strncmp(override, "strict", strlen("strict")) == 0) {
+ real_type = WMEM_ALLOCATOR_STRICT;
+ }
else {
g_warning("Unrecognized wmem override");
real_type = type;
@@ -96,6 +100,9 @@ wmem_allocator_new(const wmem_allocator_type_t type)
case WMEM_ALLOCATOR_BLOCK:
allocator = wmem_block_allocator_new();
break;
+ case WMEM_ALLOCATOR_STRICT:
+ allocator = wmem_strict_allocator_new();
+ break;
default:
g_assert_not_reached();
/* This is necessary to squelch MSVC errors; is there