From 7d66e3806beaf033935772dcbfb1f4a7a0a04651 Mon Sep 17 00:00:00 2001 From: Evan Huus Date: Tue, 15 Oct 2013 13:15:38 +0000 Subject: Don't do canaries in blocks of guint32, it appears to cause alignment issues when running tests on Solaris. Revert back to byte-at-a-time, but do fewer bytes to avoid a performance hit. svn path=/trunk/; revision=52617 --- epan/wmem/wmem_allocator_strict.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'epan/wmem') diff --git a/epan/wmem/wmem_allocator_strict.c b/epan/wmem/wmem_allocator_strict.c index 4f1f5f9db8..a67720c7a4 100644 --- a/epan/wmem/wmem_allocator_strict.c +++ b/epan/wmem/wmem_allocator_strict.c @@ -39,8 +39,8 @@ * possible. */ -#define WMEM_CANARY_SIZE 4 /* in units of guint32 */ -#define WMEM_CANARY_VALUE 0x8EE8D476 +#define WMEM_CANARY_SIZE 4 /* in bytes */ +#define WMEM_CANARY_VALUE 0x9E #define WMEM_PREFILL 0xA1 #define WMEM_POSTFILL 0x1A @@ -49,9 +49,9 @@ typedef struct _wmem_strict_allocator_block_t { /* Just the length of real_data, not counting the canaries */ gsize data_len; - guint32 *leading_canary; - guint8 *real_data; - guint32 *trailing_canary; + guint8 *leading_canary; + guint8 *real_data; + guint8 *trailing_canary; } wmem_strict_allocator_block_t; typedef struct _wmem_strict_allocator_t { @@ -105,11 +105,11 @@ wmem_strict_block_new(const size_t size) block = wmem_new(NULL, wmem_strict_allocator_block_t); block->data_len = size; - block->leading_canary = (guint32 *)wmem_alloc(NULL, block->data_len + (2 * sizeof(guint32) * WMEM_CANARY_SIZE)); - block->real_data = (guint8 *)(block->leading_canary + WMEM_CANARY_SIZE); - block->trailing_canary = (guint32 *)(block->real_data + block->data_len); + block->leading_canary = (guint8 *)wmem_alloc(NULL, block->data_len + (2 * WMEM_CANARY_SIZE)); + block->real_data = block->leading_canary + WMEM_CANARY_SIZE; + block->trailing_canary = block->real_data + block->data_len; - memset(block->real_data, WMEM_PREFILL, block->data_len); + memset(block->real_data, WMEM_PREFILL, block->data_len); for (i=0; ileading_canary[i] = WMEM_CANARY_VALUE; block->trailing_canary[i] = WMEM_CANARY_VALUE; -- cgit v1.2.3