From e6d9fcc7b259dba88706e42163f45bad4f8c7fc3 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 12 Apr 2023 11:49:13 +0100 Subject: [PATCH] oss-fuzz: Fix leak on error --- src/handle_connect.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/handle_connect.c b/src/handle_connect.c index 04237fdf..f7488d35 100644 --- a/src/handle_connect.c +++ b/src/handle_connect.c @@ -1059,7 +1059,12 @@ 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); + } /* We return an error here which means the client is freed later on. */ context->clean_start = true; context->session_expiry_interval = 0;