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