diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-03-15 01:20:03 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-03-15 01:20:03 +0300 |
commit | 99d911bad474a7c6844713b35fbd805a8b1b8ace (patch) | |
tree | fc487b770229ba99cbba9032af3a5c11ce518cc1 /src/mem_pool.h | |
parent | 63cb7c0f364df3331df235f38f1be901f04bebba (diff) | |
download | rspamd-99d911bad474a7c6844713b35fbd805a8b1b8ace.tar.gz rspamd-99d911bad474a7c6844713b35fbd805a8b1b8ace.zip |
Fix memory corruption in memory pools library.
While in here use guint8 for all pointers.
Diffstat (limited to 'src/mem_pool.h')
-rw-r--r-- | src/mem_pool.h | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/mem_pool.h b/src/mem_pool.h index d25a4dc2f..62f6dcb9a 100644 --- a/src/mem_pool.h +++ b/src/mem_pool.h @@ -39,8 +39,8 @@ typedef struct memory_pool_mutex_s { * Pool page structure */ struct _pool_chain { - u_char *begin; /**< begin of pool chain block */ - u_char *pos; /**< current start of free space in block */ + guint8 *begin; /**< begin of pool chain block */ + guint8 *pos; /**< current start of free space in block */ gsize len; /**< length of block */ struct _pool_chain *next; /**< chain link */ }; @@ -49,11 +49,11 @@ struct _pool_chain { * Shared pool page */ struct _pool_chain_shared { - u_char *begin; - u_char *pos; + guint8 *begin; + guint8 *pos; gsize len; - memory_pool_mutex_t *lock; struct _pool_chain_shared *next; + memory_pool_mutex_t *lock; }; /** @@ -268,10 +268,4 @@ void memory_pool_set_variable (memory_pool_t *pool, const gchar *name, gpointer gpointer memory_pool_get_variable (memory_pool_t *pool, const gchar *name); -/** - * Macro that return free space in pool page - * @param x pool page struct - */ -#define memory_pool_free(x) ((x)->len - (align_ptr((x)->pos, MEM_ALIGNMENT) - (x)->begin)) - #endif |