--- libaitsched/src/tasks.c 2021/06/08 21:45:07 1.28 +++ libaitsched/src/tasks.c 2022/10/17 22:45:06 1.29 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: tasks.c,v 1.28 2021/06/08 21:45:07 misho Exp $ +* $Id: tasks.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 - 2019 +Copyright 2004 - 2022 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -67,7 +67,7 @@ sched_useTask(sched_root_task_t * __restrict root) SCHED_QUNLOCK(root, taskUNUSE); if (!task) { - task = malloc(sizeof(sched_task_t)); + task = e_malloc(sizeof(sched_task_t)); if (!task) { LOGERR; return NULL; @@ -631,7 +631,7 @@ schedAIORead(sched_root_task_t * __restrict root, sche } else off = offset; - if (!(acb = malloc(sizeof(struct aiocb)))) { + if (!(acb = e_malloc(sizeof(struct aiocb)))) { LOGERR; return NULL; } else @@ -647,7 +647,7 @@ schedAIORead(sched_root_task_t * __restrict root, sche if (aio_read(acb)) { LOGERR; - free(acb); + e_free(acb); return NULL; } @@ -690,7 +690,7 @@ schedAIOWrite(sched_root_task_t * __restrict root, sch } else off = offset; - if (!(acb = malloc(sizeof(struct aiocb)))) { + if (!(acb = e_malloc(sizeof(struct aiocb)))) { LOGERR; return NULL; } else @@ -706,7 +706,7 @@ schedAIOWrite(sched_root_task_t * __restrict root, sch if (aio_write(acb)) { LOGERR; - free(acb); + e_free(acb); return NULL; } @@ -805,19 +805,19 @@ schedLIORead(sched_root_task_t * __restrict root, sche } else off = offset; - if (!(acb = calloc(sizeof(void*), nbufs))) { + if (!(acb = e_calloc(sizeof(void*), nbufs))) { LOGERR; return NULL; } else memset(acb, 0, sizeof(void*) * nbufs); for (i = 0; i < nbufs; off += bufs[i++].iov_len) { - acb[i] = malloc(sizeof(struct aiocb)); + acb[i] = e_malloc(sizeof(struct aiocb)); if (!acb[i]) { LOGERR; for (i = 0; i < nbufs; i++) if (acb[i]) - free(acb[i]); - free(acb); + e_free(acb[i]); + e_free(acb); return NULL; } else memset(acb[i], 0, sizeof(struct aiocb)); @@ -836,8 +836,8 @@ schedLIORead(sched_root_task_t * __restrict root, sche LOGERR; for (i = 0; i < nbufs; i++) if (acb[i]) - free(acb[i]); - free(acb); + e_free(acb[i]); + e_free(acb); return NULL; } @@ -882,19 +882,19 @@ schedLIOWrite(sched_root_task_t * __restrict root, sch } else off = offset; - if (!(acb = calloc(sizeof(void*), nbufs))) { + if (!(acb = e_calloc(sizeof(void*), nbufs))) { LOGERR; return NULL; } else memset(acb, 0, sizeof(void*) * nbufs); for (i = 0; i < nbufs; off += bufs[i++].iov_len) { - acb[i] = malloc(sizeof(struct aiocb)); + acb[i] = e_malloc(sizeof(struct aiocb)); if (!acb[i]) { LOGERR; for (i = 0; i < nbufs; i++) if (acb[i]) - free(acb[i]); - free(acb); + e_free(acb[i]); + e_free(acb); return NULL; } else memset(acb[i], 0, sizeof(struct aiocb)); @@ -913,8 +913,8 @@ schedLIOWrite(sched_root_task_t * __restrict root, sch LOGERR; for (i = 0; i < nbufs; i++) if (acb[i]) - free(acb[i]); - free(acb); + e_free(acb[i]); + e_free(acb); return NULL; }