From 3ea4a9a6d8d8c822e298d8b7ac9b04f264c0451c Mon Sep 17 00:00:00 2001
From: Utz-Uwe Haus <uhaus@hpe.com>
Date: Tue, 2 Nov 2021 11:50:58 +0100
Subject: [PATCH] fix leak on slot messages (envelopes and context leaked)

---
 maestro/ofi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/maestro/ofi.c b/maestro/ofi.c
index c61d1d90..91806e75 100644
--- a/maestro/ofi.c
+++ b/maestro/ofi.c
@@ -2715,7 +2715,10 @@ mstro_ofi__check_and_handle_cq(struct mstro_endpoint *ep,
     }
 
     if(re_post) {
-      ; /* fresh receive will be posted later, and slot messages have no completion watchers */
+       /* fresh receive has been posted earlier, and slot messages have no completion watchers */
+      DEBUG("slot message handled, cleaning up envelope and ctx\n");
+      mstro_msg_envelope_free(ctx->msg);
+      status = mstro_ofi__msg_context_destroy(ctx);
     } else {
       /* other recv */
       DEBUG("non-slot message, cleaning up\n");
-- 
GitLab