From 3c518160097eac998a823e33d15df38093621863 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 12 Apr 2023 11:52:26 +0100 Subject: [PATCH] Fix leak on error. --- src/handle_connect.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/handle_connect.c b/src/handle_connect.c index 21405adf..7e102ee4 100644 --- a/src/handle_connect.c +++ b/src/handle_connect.c @@ -946,7 +946,13 @@ handle_connect_error: mosquitto__free(will_struct->msg.topic); mosquitto__free(will_struct); } - context->will = NULL; + if(context->will){ + mosquitto_property_free_all(&context->will->properties); + mosquitto__free(context->will->msg.payload); + mosquitto__free(context->will->msg.topic); + mosquitto__free(context->will); + context->will = NULL; + } #ifdef WITH_TLS if(client_cert) X509_free(client_cert); #endif