summaryrefslogtreecommitdiff
path: root/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/eina/mp/chained_pool/eina_chained_mempool.c')
-rw-r--r--src/modules/eina/mp/chained_pool/eina_chained_mempool.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/modules/eina/mp/chained_pool/eina_chained_mempool.c b/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
index b32747e..d44f0bf 100644
--- a/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
+++ b/src/modules/eina/mp/chained_pool/eina_chained_mempool.c
@@ -189,7 +189,7 @@ _eina_chained_mempool_alloc_in(Chained_Mempool *pool, Chained_Pool *p)
189 mem = p->last; 189 mem = p->last;
190 p->last += pool->item_alloc; 190 p->last += pool->item_alloc;
191 if (p->last >= p->limit) 191 if (p->last >= p->limit)
192 p->last = NULL; 192 p->last = NULL;
193 } 193 }
194 else 194 else
195 { 195 {
@@ -199,11 +199,11 @@ _eina_chained_mempool_alloc_in(Chained_Mempool *pool, Chained_Pool *p)
199 // Request a free pointer 199 // Request a free pointer
200 mem = eina_trash_pop(&p->base); 200 mem = eina_trash_pop(&p->base);
201 } 201 }
202 202
203 // move to end - it just filled up 203 // move to end - it just filled up
204 if (!p->base && !p->last) 204 if (!p->base && !p->last)
205 pool->first = eina_inlist_demote(pool->first, EINA_INLIST_GET(p)); 205 pool->first = eina_inlist_demote(pool->first, EINA_INLIST_GET(p));
206 206
207 p->usage++; 207 p->usage++;
208 pool->usage++; 208 pool->usage++;
209 209
@@ -411,6 +411,15 @@ eina_chained_mempool_from(void *data, void *ptr)
411 goto end; 411 goto end;
412 } 412 }
413 413
414 // is the pointer in the allocated zone of the mempool
415 if (p->last != NULL && ((unsigned char *)ptr >= p->last))
416 {
417#ifdef DEBUG
418 ERR("%p has not been allocated yet from %p pool of %p '%s' Chained_Mempool.", ptr, p, pool, pool->name);
419#endif
420 goto end;
421 }
422
414 // is it really a pointer returned by malloc 423 // is it really a pointer returned by malloc
415 if ((((unsigned char *)ptr) - (unsigned char *)(p + 1)) % pool->item_alloc) 424 if ((((unsigned char *)ptr) - (unsigned char *)(p + 1)) % pool->item_alloc)
416 { 425 {