From 936ce6f09f67368d566c884ba04231123e0c5332 Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Wed, 27 Sep 2023 11:30:50 +0100 Subject: [PATCH] CRAN release 0.10.2 --- DESCRIPTION | 2 +- NEWS.md | 6 +++++- src/aio.c | 10 +++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8797b82df..089bc4b2d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: nanonext Type: Package Title: NNG (Nanomsg Next Gen) Lightweight Messaging Library -Version: 0.10.1.9000 +Version: 0.10.2 Description: R binding for NNG (Nanomsg Next Gen), a successor to ZeroMQ. NNG is a socket library providing high-performance scalability protocols, a cross-platform standard for messaging and communications. Serves as a diff --git a/NEWS.md b/NEWS.md index 39db0e6c8..3ec3ce2fc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,8 @@ -# nanonext 0.10.1.9000 (development) +# nanonext 0.10.2 + +#### Updates + +* Addresses one case of memory access error identified by CRAN. # nanonext 0.10.1 diff --git a/src/aio.c b/src/aio.c index d2209f3a5..815b00c3e 100644 --- a/src/aio.c +++ b/src/aio.c @@ -215,9 +215,13 @@ static void raio_complete_ack(void *arg) { if (nng_aio_alloc(&aio, NULL, NULL) == 0) { nng_aio_set_msg(aio, msg); nng_ctx_send(*ctx, aio); + nng_aio_wait(aio); + if (nng_aio_result(aio)) + nng_msg_free(nng_aio_get_msg(aio)); nng_aio_free(aio); + } else { + nng_msg_free(msg); } - nng_msg_free(msg); } nng_mtx_lock(shr_mtx); @@ -227,8 +231,8 @@ static void raio_complete_ack(void *arg) { #else if (nng_msg_alloc(&msg, 0) == 0) { - nng_ctx_sendmsg(*ctx, msg, 0); - nng_msg_free(msg); + if (nng_ctx_sendmsg(*ctx, msg, 0)) + nng_msg_free(msg); } raio->result = res - !res;