diff --git a/src/zabbix_server/preprocessor/linked_list.c b/src/zabbix_server/preprocessor/linked_list.c
index cf85447..3a9e4f4 100644
--- a/src/zabbix_server/preprocessor/linked_list.c
+++ b/src/zabbix_server/preprocessor/linked_list.c
@@ -63,14 +63,13 @@ void	zbx_list_destroy(zbx_list_t *list)
  *             created  - [OUT] pointer to the created list item              *
  *                                                                            *
  ******************************************************************************/
-static void	list_create_item(zbx_list_t *list, const void *value, zbx_list_item_t **created)
+static void	list_create_item(zbx_list_t *list, void *value, zbx_list_item_t **created)
 {
 	zbx_list_item_t *item;
 
 	item = (zbx_list_item_t *)zbx_malloc(NULL, sizeof(zbx_list_item_t));
 	item->next = NULL;
-	item->data = zbx_malloc(NULL, list->size);
-	memcpy(item->data, value, list->size);
+	item->data = value;
 
 	*created = item;
 }
@@ -88,7 +87,7 @@ static void	list_create_item(zbx_list_t *list, const void *value, zbx_list_item_
  *             inserted - [OUT] pointer to the inserted list item             *
  *                                                                            *
  ******************************************************************************/
-void	zbx_list_insert_after(zbx_list_t *list, zbx_list_item_t *after, const void *value, zbx_list_item_t **inserted)
+void	zbx_list_insert_after(zbx_list_t *list, zbx_list_item_t *after, void *value, zbx_list_item_t **inserted)
 {
 	zbx_list_item_t *item;
 
@@ -123,7 +122,7 @@ void	zbx_list_insert_after(zbx_list_t *list, zbx_list_item_t *after, const void
  *             inserted - [OUT] pointer to the inserted list item             *
  *                                                                            *
  ******************************************************************************/
-void	zbx_list_append(zbx_list_t *list, const void *value, zbx_list_item_t **inserted)
+void	zbx_list_append(zbx_list_t *list, void *value, zbx_list_item_t **inserted)
 {
 	return zbx_list_insert_after(list, NULL, value, inserted);
 }
@@ -139,7 +138,7 @@ void	zbx_list_append(zbx_list_t *list, const void *value, zbx_list_item_t **inse
  *             inserted - [OUT] pointer to the inserted list item             *
  *                                                                            *
  ******************************************************************************/
-void	zbx_list_prepend(zbx_list_t *list, const void *value, zbx_list_item_t **inserted)
+void	zbx_list_prepend(zbx_list_t *list, void *value, zbx_list_item_t **inserted)
 {
 	zbx_list_item_t *item;
 
@@ -167,7 +166,7 @@ void	zbx_list_prepend(zbx_list_t *list, const void *value, zbx_list_item_t **ins
  *               returned.                                                    *
  *                                                                            *
  ******************************************************************************/
-int	zbx_list_pop(zbx_list_t *list, void *value)
+int	zbx_list_pop(zbx_list_t *list, void **value)
 {
 	zbx_list_item_t	*head;
 
@@ -175,11 +174,10 @@ int	zbx_list_pop(zbx_list_t *list, void *value)
 		return FAIL;
 
 	if (NULL != value)
-		memcpy(value, list->head->data, list->size);
+		*value = head->data;
 
 	head = list->head;
 	list->head = list->head->next;
-	zbx_free(head->data);
 	zbx_free(head);
 
 	if (NULL == list->head)
diff --git a/src/zabbix_server/preprocessor/linked_list.h b/src/zabbix_server/preprocessor/linked_list.h
index a0afcad..d67bbc0 100644
--- a/src/zabbix_server/preprocessor/linked_list.h
+++ b/src/zabbix_server/preprocessor/linked_list.h
@@ -50,10 +50,10 @@ zbx_list_iterator_t;
 
 void	zbx_list_create(zbx_list_t *list, unsigned int size);
 void	zbx_list_destroy(zbx_list_t *list);
-void	zbx_list_append(zbx_list_t *list, const void *value, zbx_list_item_t **enqueued);
-void	zbx_list_insert_after(zbx_list_t *list, zbx_list_item_t *after, const void *value, zbx_list_item_t **enqueued);
-void	zbx_list_prepend(zbx_list_t *list, const void *value, zbx_list_item_t **enqueued);
-int	zbx_list_pop(zbx_list_t *list, void *value);
+void	zbx_list_append(zbx_list_t *list, void *value, zbx_list_item_t **enqueued);
+void	zbx_list_insert_after(zbx_list_t *list, zbx_list_item_t *after, void *value, zbx_list_item_t **enqueued);
+void	zbx_list_prepend(zbx_list_t *list, void *value, zbx_list_item_t **enqueued);
+int	zbx_list_pop(zbx_list_t *list, void **value);
 int	zbx_list_peek(const zbx_list_t *list, void **value);
 void	zbx_list_iterator_init(zbx_list_t *list, zbx_list_iterator_t *iterator);
 int	zbx_list_iterator_next(zbx_list_iterator_t *iterator);
diff --git a/src/zabbix_server/preprocessor/preproc_manager.c b/src/zabbix_server/preprocessor/preproc_manager.c
index decb84d..d83bc13 100644
--- a/src/zabbix_server/preprocessor/preproc_manager.c
+++ b/src/zabbix_server/preprocessor/preproc_manager.c
@@ -329,9 +329,6 @@ static void	preprocessor_assign_tasks(zbx_preprocessing_manager_t *manager)
 
 		request_free_steps(request);
 		zbx_free(task);
-
-		if (NULL != request->dependency)
-			request->dependency->locks--;
 	}
 
 	zabbix_log(LOG_LEVEL_DEBUG, "End of %s()", __function_name);
@@ -348,6 +345,15 @@ static void	preprocessor_assign_tasks(zbx_preprocessing_manager_t *manager)
  ******************************************************************************/
 static void	preprocessor_free_request(zbx_preprocessing_request_t *request)
 {
+	if (0 != request->locks)
+		return;
+
+	if (NULL != request->dependency)
+	{
+		request->dependency->locks--;
+		preprocessor_free_request(request->dependency);
+	}
+
 	zbx_free(request->value.error);
 
 	if (NULL != request->value.result)
@@ -369,6 +375,7 @@ static void	preprocessor_free_request(zbx_preprocessing_request_t *request)
 	zbx_free(request->value.ts);
 
 	request_free_steps(request);
+	zbx_free(request);
 }
 
 
@@ -401,12 +408,13 @@ static void	preprocessing_flush_queue(zbx_preprocessing_manager_t *manager)
 {
 	zbx_preprocessing_request_t	*request;
 
-	while (SUCCEED == zbx_list_peek(&manager->queue, (void **)&request) && REQUEST_STATE_DONE == request->state &&
-			0 == request->locks)
+	while (SUCCEED == zbx_list_peek(&manager->queue, (void **)&request) && REQUEST_STATE_DONE == request->state)
 	{
 		preprocessor_flush_request(request);
 		preprocessor_free_request(request);
+
 		zbx_list_pop(&manager->queue, NULL);
+
 		manager->processed_num++;
 		manager->queued_num--;
 	}
@@ -536,60 +544,60 @@ static void	preprocessor_enqueue(zbx_preprocessing_manager_t *manager, zbx_prepr
 		zbx_list_item_t *master)
 {
 	const char			*__function_name = "preprocessor_enqueue";
-	zbx_preprocessing_request_t	request;
+	zbx_preprocessing_request_t	*request;
 	zbx_preproc_item_t		*item, item_local;
 	zbx_list_item_t			*enqueued_at;
 	int				i;
 
 	zabbix_log(LOG_LEVEL_DEBUG, "In %s() itemid: %" PRIu64, __function_name, value->itemid);
 
-	memset(&request, 0, sizeof(zbx_preprocessing_request_t));
-	memcpy(&request.value, value, sizeof(zbx_preproc_item_value_t));
+	request = (zbx_preprocessing_request_t *)zbx_malloc(NULL, sizeof(zbx_preprocessing_request_t));
+	memset(request, 0, sizeof(zbx_preprocessing_request_t));
+	memcpy(&request->value, value, sizeof(zbx_preproc_item_value_t));
 	item_local.itemid = value->itemid;
 	item = zbx_hashset_search(&manager->item_config, &item_local);
 
 	if (NULL != value->result && ISSET_VALUE(value->result) && NULL != item && 0 != item->preproc_ops_num)
 	{
-		request.state = REQUEST_STATE_QUEUED;
-		request.value_type = item->value_type;
+		request->state = REQUEST_STATE_QUEUED;
+		request->value_type = item->value_type;
 
-		request.steps = zbx_malloc(NULL, sizeof(zbx_preproc_op_t) * item->preproc_ops_num);
-		request.steps_num = item->preproc_ops_num;
+		request->steps = zbx_malloc(NULL, sizeof(zbx_preproc_op_t) * item->preproc_ops_num);
+		request->steps_num = item->preproc_ops_num;
 
 		for (i = 0; i < item->preproc_ops_num; i++)
 		{
-			request.steps[i].type = item->preproc_ops[i].type;
-			request.steps[i].params = zbx_strdup(NULL, item->preproc_ops[i].params);
+			request->steps[i].type = item->preproc_ops[i].type;
+			request->steps[i].params = zbx_strdup(NULL, item->preproc_ops[i].params);
 		}
 	}
 	else
 	{
-		request.state = REQUEST_STATE_DONE;
+		request->state = REQUEST_STATE_DONE;
 
 		if (NULL == manager->queue.head || (NULL != item && ITEM_TYPE_INTERNAL == item->type))
 		{
 			/* queue is empty (or item is an internal check), item is done, it can be flushed */
-			preprocessor_flush_request(&request);
+			preprocessor_flush_request(request);
 			manager->processed_num++;
-			preprocessor_enqueue_dependent(manager, &request, NULL);
-			preprocessor_free_request(&request);
-
+			preprocessor_enqueue_dependent(manager, request, NULL);
+			preprocessor_free_request(request);
 			goto out;
 		}
 	}
 
 	/* internal items are enqueued at the beginning of the line */
 	if (NULL != item && ITEM_TYPE_INTERNAL == item->type)
-		zbx_list_prepend(&manager->queue, &request, &enqueued_at);
+		zbx_list_prepend(&manager->queue, request, &enqueued_at);
 	else
-		zbx_list_insert_after(&manager->queue, master, &request, &enqueued_at);
+		zbx_list_insert_after(&manager->queue, master, request, &enqueued_at);
 
-	if (REQUEST_STATE_QUEUED == request.state)
+	if (REQUEST_STATE_QUEUED == request->state)
 		preprocessor_link_delta_items(manager, enqueued_at, item);
 
 	/* if no preprocessing is needed, dependent items are enqueued */
-	if (REQUEST_STATE_DONE == request.state)
-		preprocessor_enqueue_dependent(manager, &request, enqueued_at);
+	if (REQUEST_STATE_DONE == request->state)
+		preprocessor_enqueue_dependent(manager, request, enqueued_at);
 
 	manager->queued_num++;
 
