--- libaitsched/src/aitsched.c 2014/06/05 22:37:29 1.26 +++ libaitsched/src/aitsched.c 2022/10/17 22:45:06 1.29 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitsched.c,v 1.26 2014/06/05 22:37:29 misho Exp $ +* $Id: aitsched.c,v 1.29 2022/10/17 22:45:06 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004 - 2014 +Copyright 2004 - 2022 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -215,7 +215,7 @@ schedInit(void ** __restrict data, size_t datlen) register int i; #endif - root = malloc(sizeof(sched_root_task_t)); + root = e_malloc(sizeof(sched_root_task_t)); if (!root) { LOGERR; } else { @@ -233,7 +233,7 @@ schedInit(void ** __restrict data, size_t datlen) LOGERR; while (i) pthread_mutex_destroy(&root->root_mtx[--i]); - free(root); + e_free(root); return NULL; } @@ -373,7 +373,7 @@ schedEnd(sched_root_task_t ** __restrict root) SCHED_QLOCK((*root), taskUNUSE); TAILQ_FOREACH_SAFE(task, &(*root)->root_unuse, task_node, tmp) { TAILQ_REMOVE(&(*root)->root_unuse, task, task_node); - free(task); + e_free(task); } SCHED_QUNLOCK((*root), taskUNUSE); @@ -382,12 +382,13 @@ schedEnd(sched_root_task_t ** __restrict root) #ifdef HAVE_LIBPTHREAD for (i = 0; i < taskMAX; i++) { + SCHED_QTRYLOCK(*root, i); SCHED_QUNLOCK(*root, i); pthread_mutex_destroy(&(*root)->root_mtx[i]); } #endif - free(*root); + e_free(*root); *root = NULL; return 0; }