From 705d39a6daf99b44c820631f04a116cc09b134b5 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 7 Aug 2017 18:16:06 -0700 Subject: Address possible leak on send failure. --- src/nng.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nng.c b/src/nng.c index 54df9980..ac84012a 100644 --- a/src/nng.c +++ b/src/nng.c @@ -182,7 +182,8 @@ nng_send(nng_socket sid, void *buf, size_t len, int flags) memcpy(nng_msg_body(msg), buf, len); if ((rv = nng_sendmsg(sid, msg, flags)) != 0) { nng_msg_free(msg); - } else if (flags & NNG_FLAG_ALLOC) { + } + if (flags & NNG_FLAG_ALLOC) { nni_free(buf, len); } return (rv); -- cgit v1.2.3-70-g09d2