From 5d594e39538e105e52d95b0b5f816674d80c6d07 Mon Sep 17 00:00:00 2001
From: Armin Luntzer <armin.luntzer@univie.ac.at>
Date: Mon, 10 Apr 2017 15:50:13 +0200
Subject: [PATCH] data processing network: instead of destroying the task
 immediately, move it to the output node for proper deallocation

---
 lib/data_proc_net.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/data_proc_net.c b/lib/data_proc_net.c
index aa6a4d7..1d3fecf 100644
--- a/lib/data_proc_net.c
+++ b/lib/data_proc_net.c
@@ -337,8 +337,14 @@ int pn_eval_task_status(struct proc_net *pn, struct proc_tracker *pt,
 
 	case PN_TASK_DESTROY:
 		pr_debug(MSG "destroy task\n");
-		/* something is wrong, destroy this task */
-		pt_destroy(t);
+		/* something is wrong, destroy this task by clearing 
+		 * its member count and pending steps, so it is moved
+		 * directly to the output node, where it can be deallocated
+		 * by the user's ouput function
+		 */
+		pt_set_nmemb(t, 0);
+		pt_del_all_pending(t);
+		pn_task_to_next_node(pn, t);
 		goto task_continue;
 
 	default:
-- 
GitLab