From 2617dee69f3176fe9fa774d4b13dae1c6420e4d1 Mon Sep 17 00:00:00 2001 From: Anurag Kar Date: Fri, 28 Jun 2019 12:12:42 +0530 Subject: [PATCH] wifi_prov_mgr : Free memory allocated by cJSON_Print --- components/wifi_provisioning/src/manager.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/wifi_provisioning/src/manager.c b/components/wifi_provisioning/src/manager.c index af7991fa76..41b998463c 100644 --- a/components/wifi_provisioning/src/manager.c +++ b/components/wifi_provisioning/src/manager.c @@ -284,7 +284,9 @@ static esp_err_t wifi_prov_mgr_start_service(const char *service_name, const cha /* Set version information / capabilities of provisioning service and application */ cJSON *version_json = wifi_prov_get_info_json(); - ret = protocomm_set_version(prov_ctx->pc, "proto-ver", cJSON_Print(version_json)); + char *version_str = cJSON_Print(version_json); + ret = protocomm_set_version(prov_ctx->pc, "proto-ver", version_str); + free(version_str); cJSON_Delete(version_json); if (ret != ESP_OK) { ESP_LOGE(TAG, "Failed to set version endpoint");