diff --git a/module/transport/src/mod_transport.c b/module/transport/src/mod_transport.c index 30727ad301f92142cc6872f859eee4c86430a9c0..9a435ac02fd258ded093053c82fd900e2c0f4947 100644 --- a/module/transport/src/mod_transport.c +++ b/module/transport/src/mod_transport.c @@ -454,6 +454,29 @@ static int transport_release_channel_lock(fwk_id_t channel_id) * transport_respond() function that releases the channel context. */ channel_ctx->locked = false; + + if (channel_ctx->config->transport_type == + MOD_TRANSPORT_CHANNEL_TRANSPORT_TYPE_OUT_BAND) { + /* + * For Out-of-band communication channels: + * After processing a message, unlock the shared buffer memory by + * marking it as free, so that other applications can reuse it. + * This enusures proper buffer management and prevents the + * resource leaks. + */ + struct mod_transport_buffer *buffer = NULL; + buffer = ((struct mod_transport_buffer *) + channel_ctx->config->out_band_mailbox_address); + + if (buffer == NULL) { + FWK_LOG_ERR( + "%s ERROR: NULL buffer in \"%s()\"", MOD_NAME, __func__); + return FWK_E_PANIC; + } + + buffer->status |= MOD_TRANSPORT_MAILBOX_STATUS_FREE_MASK; + } + return FWK_SUCCESS; }