summaryrefslogtreecommitdiffstats
path: root/src/mem_pool.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-03 13:44:50 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-03-03 13:44:50 +0300
commit3ff032cf72164dc9aa8575c0a631f7c7b0079f46 (patch)
tree98a7b11bf70232a6c0825591957352f2d4acc9b9 /src/mem_pool.c
parentf972cde13ca98f6ed992a288826467abf04c888a (diff)
downloadrspamd-3ff032cf72164dc9aa8575c0a631f7c7b0079f46.tar.gz
rspamd-3ff032cf72164dc9aa8575c0a631f7c7b0079f46.zip
* New rspamd protocol (changed replies)
* Add ability to attach string lists to symbols * Check destructors and do not add identical destructors (argument and function) to pool's destructors * Remove 2 warnings when building with gmime22 * Attach url names to surbl symbols * Fix bug with blocking on read (I think it is linux specific thought)
Diffstat (limited to 'src/mem_pool.c')
-rw-r--r--src/mem_pool.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mem_pool.c b/src/mem_pool.c
index 23f25b5f3..db8e3f351 100644
--- a/src/mem_pool.c
+++ b/src/mem_pool.c
@@ -331,10 +331,20 @@ void memory_pool_unlock_shared (memory_pool_t *pool, void *pointer)
void
memory_pool_add_destructor (memory_pool_t *pool, pool_destruct_func func, void *data)
{
- struct _pool_destructors *cur;
+ struct _pool_destructors *cur, *tmp;
cur = memory_pool_alloc (pool, sizeof (struct _pool_destructors));
if (cur) {
+ /* Check whether we have identical destructor in pool */
+ tmp = pool->destructors;
+ while (tmp) {
+ if (tmp->func == func && tmp->data == data) {
+ /* Do not add identical destructors, they must be unique */
+ return;
+ }
+ tmp = tmp->prev;
+ }
+
cur->func = func;
cur->data = data;
cur->prev = pool->destructors;