summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2021-12-29 19:47:55 -0800
committerGarrett D'Amore <garrett@damore.org>2021-12-29 20:00:14 -0800
commit2f66b99830e6dc731e4f631ea743771df701659e (patch)
treeaad1c048cde3f6dcc40a6b8d55e03eda50d81725 /src/core
parent44fadb7042fbfdf75f20572c59e410f406bb82f4 (diff)
downloadnng-2f66b99830e6dc731e4f631ea743771df701659e.tar.gz
nng-2f66b99830e6dc731e4f631ea743771df701659e.tar.bz2
nng-2f66b99830e6dc731e4f631ea743771df701659e.zip
Fix leak of messages lost during device abort.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/device.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/device.c b/src/core/device.c
index c7266271..08c7bab5 100644
--- a/src/core/device.c
+++ b/src/core/device.c
@@ -78,6 +78,10 @@ device_cb(void *arg)
if ((rv = nni_aio_result(&p->aio)) != 0) {
nni_mtx_lock(&device_mtx);
+ if (p->state == NNI_DEVICE_STATE_SEND) {
+ nni_msg_free(nni_aio_get_msg(&p->aio));
+ nni_aio_set_msg(&p->aio, NULL);
+ }
p->state = NNI_DEVICE_STATE_FINI;
d->running--;
if (d->rv == 0) {