--- libaitsess/src/sess.c 2011/09/07 23:38:39 1.3.2.5 +++ libaitsess/src/sess.c 2011/11/03 15:36:03 1.3.2.7 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: sess.c,v 1.3.2.5 2011/09/07 23:38:39 misho Exp $ +* $Id: sess.c,v 1.3.2.7 2011/11/03 15:36:03 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -359,11 +359,12 @@ sess_prepareSession(tagSess * __restrict s, u_char use DEC_SEMAPHORE(s, ret); s->zcopy = useDirect; - arr = io_map2vals(s->addr + sizeof(sess_hdr_t), s->eom - sizeof(sess_hdr_t), + arr = io_map2vars(s->addr + sizeof(sess_hdr_t), s->eom - sizeof(sess_hdr_t), hdr->hdr_argc, useDirect); ADD_SEMAPHORE(s, ret); - DETACH_MEMORY(s); + if (!s->zcopy) + DETACH_MEMORY(s); return arr; } @@ -384,6 +385,8 @@ sess_doneSession(tagSess * __restrict s, array_t ** __ if (!s->zcopy) io_arrayFree(*arr); + else + DETACH_MEMORY(s); io_arrayDestroy(arr); } @@ -413,7 +416,7 @@ sess_commitSession(tagSess * __restrict s, array_t * _ hdr = (sess_hdr_t*) s->addr; DEC_SEMAPHORE(s, rs); - if ((ret = io_vals2map(s->addr + sizeof(sess_hdr_t), s->eom - sizeof(sess_hdr_t), arr)) != -1) { + if ((ret = io_vars2map(s->addr + sizeof(sess_hdr_t), s->eom - sizeof(sess_hdr_t), arr)) != -1) { hdr->hdr_magic = SESS_AIT_MAGIC; hdr->hdr_argc = io_arraySize(arr); ret += sizeof(sess_hdr_t);