aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wmem/wmem_core.c
diff options
context:
space:
mode:
authorEvan Huus <eapache@gmail.com>2012-12-27 22:31:42 +0000
committerEvan Huus <eapache@gmail.com>2012-12-27 22:31:42 +0000
commitdc98756ca4b6c0966c90ca8925653b7b1759941b (patch)
tree11f27ccb360eb2abf2aa5b0e8aa352ab88b2f3c6 /epan/wmem/wmem_core.c
parent347a8a2115c8de01a0bc80f2e7744e00f3034cc2 (diff)
Store the type of each wmem allocator.
svn path=/trunk/; revision=46814
Diffstat (limited to 'epan/wmem/wmem_core.c')
-rw-r--r--epan/wmem/wmem_core.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/epan/wmem/wmem_core.c b/epan/wmem/wmem_core.c
index c3006b0125..8181ace30a 100644
--- a/epan/wmem/wmem_core.c
+++ b/epan/wmem/wmem_core.c
@@ -65,19 +65,25 @@ wmem_destroy_allocator(wmem_allocator_t *allocator)
wmem_allocator_t *
wmem_allocator_new(const wmem_allocator_type_t type)
{
+ wmem_allocator_t *allocator;
+
/* Our valgrind script uses this environment variable to override the
* usual allocator choice so that everything goes through system-level
* allocations that it understands and can track. Otherwise it will get
* confused by the block allocator etc. */
if (getenv("WIRESHARK_DEBUG_WMEM_SIMPLE")) {
- return wmem_simple_allocator_new();
+ allocator = wmem_simple_allocator_new();
+ allocator->type = WMEM_ALLOCATOR_SIMPLE;
+ return allocator;
}
switch (type) {
case WMEM_ALLOCATOR_SIMPLE:
- return wmem_simple_allocator_new();
+ allocator = wmem_simple_allocator_new();
+ break;
case WMEM_ALLOCATOR_BLOCK:
- return wmem_block_allocator_new();
+ allocator = wmem_block_allocator_new();
+ break;
default:
g_assert_not_reached();
/* This is necessary to squelch MSVC errors; is there
@@ -85,6 +91,10 @@ wmem_allocator_new(const wmem_allocator_type_t type)
never returns? */
return NULL;
};
+
+ allocator->type = type;
+
+ return allocator;
}
void