--- libaitsess/src/sess.c 2012/02/10 23:38:30 1.4 +++ libaitsess/src/sess.c 2012/07/22 22:13:48 1.5 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: sess.c,v 1.4 2012/02/10 23:38:30 misho Exp $ +* $Id: sess.c,v 1.5 2012/07/22 22:13:48 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -63,8 +63,8 @@ sess_FreeValues(char *** __restrict ppsVals) return; for (ptr = *ppsVals; *ptr; ptr++) - free(*ptr); - free(*ppsVals); + io_free(*ptr); + io_free(*ppsVals); *ppsVals = NULL; } @@ -84,7 +84,7 @@ sess_GetValues(ait_sess_t * __restrict s, char ***ppsV if (!s || !ppsVals) return -1; - valz = malloc(sizeof(caddr_t)); + valz = io_malloc(sizeof(caddr_t)); if (!valz) { LOGERR; return -1; @@ -92,10 +92,10 @@ sess_GetValues(ait_sess_t * __restrict s, char ***ppsV *valz = NULL; // allocated memory & mirrored shared memory into this - Shared = malloc(s->eom); + Shared = io_malloc(s->eom); if (!Shared) { LOGERR; - free(valz); + io_free(valz); return -1; } else memcpy(Shared, s->addr, s->eom); @@ -107,18 +107,18 @@ sess_GetValues(ait_sess_t * __restrict s, char ***ppsV else i++; - valz = realloc(valz, (i + 1) * sizeof(caddr_t)); + valz = io_realloc(valz, (i + 1) * sizeof(caddr_t)); if (!valz) { LOGERR; - free(Shared); + io_free(Shared); return -1; } else valz[i] = NULL; - valz[i - 1] = strdup(peer); + valz[i - 1] = io_strdup(peer); } - free(Shared); + io_free(Shared); *ppsVals = valz; return i; } @@ -151,7 +151,7 @@ sess_GetValue(ait_sess_t * __restrict s, const char *c } // allocated memory & mirrored shared memory into this - Shared = malloc(s->eom); + Shared = io_malloc(s->eom); if (!Shared) { LOGERR; return -1; @@ -171,12 +171,12 @@ sess_GetValue(ait_sess_t * __restrict s, const char *c } else def = IS_DEF; - free(Shared); + io_free(Shared); return i | def; } } - free(Shared); + io_free(Shared); return 0; } @@ -203,16 +203,16 @@ sess_DelValue(ait_sess_t * __restrict s, const char *c strlcpy(szAttr, csAttr, sizeof szAttr); strlcat(szAttr, "=", sizeof szAttr); - Buffer = malloc(s->eom); + Buffer = io_malloc(s->eom); if (!Buffer) { LOGERR; return -1; } else memset(Buffer, 0, s->eom); - Shared = malloc(s->eom); + Shared = io_malloc(s->eom); if (!Shared) { LOGERR; - free(Buffer); + io_free(Buffer); return -1; } else { DEC_SEM(s); @@ -236,8 +236,8 @@ sess_DelValue(ait_sess_t * __restrict s, const char *c msync(s->addr, 0, MS_SYNC | MS_INVALIDATE); INC_SEM(s); - free(Shared); - free(Buffer); + io_free(Shared); + io_free(Buffer); return 0; } @@ -265,16 +265,16 @@ sess_SetValue(ait_sess_t * __restrict s, const char *c strlcpy(szAttr, csAttr, sizeof szAttr); strlcat(szAttr, "=", sizeof szAttr); - Buffer = malloc(s->eom); + Buffer = io_malloc(s->eom); if (!Buffer) { LOGERR; return -1; } else memset(Buffer, 0, s->eom); - Shared = malloc(s->eom); + Shared = io_malloc(s->eom); if (!Shared) { LOGERR; - free(Buffer); + io_free(Buffer); return -1; } else { DEC_SEM(s); @@ -320,8 +320,8 @@ sess_SetValue(ait_sess_t * __restrict s, const char *c msync(s->addr, 0, MS_SYNC | MS_INVALIDATE); INC_SEM(s); - free(Shared); - free(Buffer); + io_free(Shared); + io_free(Buffer); return upd | def; }