From 09bc970dab65ab61abe1b7d61949aadb720fa47e Mon Sep 17 00:00:00 2001 From: yuqing Date: Mon, 22 Feb 2016 18:34:41 +0800 Subject: [PATCH] bugfixed: free task point correctly in free_queue_destroy --- HISTORY | 3 ++- src/fast_task_queue.c | 26 +++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/HISTORY b/HISTORY index 525ac1c..7ab6dc4 100644 --- a/HISTORY +++ b/HISTORY @@ -1,6 +1,7 @@ -Version 1.25 2016-02-19 +Version 1.25 2016-02-22 * php7_ext_wrapper.h add more macro defines * compile passed in FreeBSD 10.2 + * bugfixed: free task point correctly in free_queue_destroy Version 1.24 2016-02-15 * php extension compiled on PHP 7 diff --git a/src/fast_task_queue.c b/src/fast_task_queue.c index d5827fa..9c293df 100644 --- a/src/fast_task_queue.c +++ b/src/fast_task_queue.c @@ -313,17 +313,21 @@ void free_queue_destroy() char *pCharEnd; struct fast_task_info *pTask; - pCharEnd = ((char *)g_mpool.head->blocks) + g_free_queue.block_size * - g_free_queue.alloc_connections; - for (p=(char *)g_mpool.head->blocks; pdata != NULL) - { - free(pTask->data); - pTask->data = NULL; - } - } + mpool = g_mpool.head; + while (mpool != NULL) + { + pCharEnd = (char *)mpool->last_block + g_free_queue.block_size; + for (p=(char *)mpool->blocks; pdata != NULL) + { + free(pTask->data); + pTask->data = NULL; + } + } + mpool = mpool->next; + } } mpool = g_mpool.head;