[Cbe-oss-dev] [PATCH 4/7]MARS/core: Fix memory leak in mars task destroy

Yuji Mano yuji.mano at am.sony.com
Wed Oct 29 06:05:36 EST 2008


This fixes a memory leak in mars_task_destroy where an allocated context save
unit storage area is not properly freed.

Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>

---
 core/src/host/lib/task.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- a/core/src/host/lib/task.c
+++ b/core/src/host/lib/task.c
@@ -204,10 +204,14 @@ int mars_task_destroy(struct mars_task_i
 	/* cast workload context to task context */
 	task = (struct mars_task_context *)workload;
 
-	/* free the allocated task context area if it has one */
+	/* free the allocated context save area if it has one */
 	if (task->context_save_area_ea)
 		free(mars_ea_to_ptr(task->context_save_area_ea));
 
+	/* free the allocated context save unit storage if it has one */
+	if (task->context_save_unit_ea)
+		free(mars_ea_to_ptr(task->context_save_unit_ea));
+
 	/* end process to remove the task from the workload queue */
 	ret = mars_workload_queue_remove_end(mars->workload_queue,
 		id->workload_id);






More information about the cbe-oss-dev mailing list