From d81c343c9a1dfa49b5d7763835ee8ea45dba53c5 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Fri, 21 Aug 2020 10:59:52 -0400 Subject: Fix memory leak There was a memory leak in the call to recv_any(), which would allocate a condition variable and never free it once per call. --- src/lua-nng-aio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lua-nng-aio.c b/src/lua-nng-aio.c index a4f8944..0886233 100644 --- a/src/lua-nng-aio.c +++ b/src/lua-nng-aio.c @@ -172,10 +172,10 @@ void push_callback(void *v){ //messages can be thrown out becuase of the canceling of the async recieves. //recv_any(socket1, socket2, ...) :: socket | false, message | errmsg, int lnng_aio_recv(lua_State *L){ - nng_mtx *luamtx, *callbackmtx, *setupmtx; + nng_mtx *luamtx, *callbackmtx; int err = nng_mtx_alloc(&luamtx); err |= nng_mtx_alloc(&callbackmtx); - err |= nng_mtx_alloc(&setupmtx); + /*err |= nng_mtx_alloc(&setupmtx);*/ if(err != 0){ /*printf("Something when wrong when allocating mutexes\n");*/ lua_pushboolean(L,0); -- cgit v1.2.3-70-g09d2