File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -1226,8 +1226,10 @@ mqtt_client_t *mqtt_lease(void)
12261226 memset (c , 0 , sizeof (mqtt_client_t ));
12271227
12281228 rc = mqtt_init (c );
1229- if (MQTT_SUCCESS_ERROR != rc )
1229+ if (MQTT_SUCCESS_ERROR != rc ) {
1230+ platform_memory_free (c );
12301231 return NULL ;
1232+ }
12311233
12321234 return c ;
12331235}
@@ -1266,10 +1268,15 @@ int mqtt_release(mqtt_client_t* c)
12661268 c -> mqtt_write_buf = NULL ;
12671269 }
12681270
1271+ if (NULL != c -> mqtt_will_options ) {
1272+ platform_memory_free (c -> mqtt_will_options );
1273+ c -> mqtt_will_options = NULL ;
1274+ }
1275+
12691276 platform_mutex_destroy (& c -> mqtt_write_lock );
12701277 platform_mutex_destroy (& c -> mqtt_global_lock );
12711278
1272- memset ( c , 0 , sizeof ( mqtt_client_t ) );
1279+ platform_memory_free ( c );
12731280
12741281 RETURN_ERROR (MQTT_SUCCESS_ERROR );
12751282}
You can’t perform that action at this time.
0 commit comments