From 5bf4ed57c4fb1d0aaaa20d1ac6a48e4324a17c1a Mon Sep 17 00:00:00 2001 From: Joel Guittet Date: Thu, 20 Jun 2024 00:13:18 +0200 Subject: [PATCH] add-ons: configure: fix double free error --- add-ons/src/mender-configure.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/add-ons/src/mender-configure.c b/add-ons/src/mender-configure.c index 9edcbb7..bc757b7 100644 --- a/add-ons/src/mender-configure.c +++ b/add-ons/src/mender-configure.c @@ -52,7 +52,7 @@ static mender_configure_config_t mender_configure_config; static mender_configure_callbacks_t mender_configure_callbacks; /** - * @brief Mender configure + * @brief Mender configure keystore */ static mender_keystore_t *mender_configure_keystore = NULL; static void * mender_configure_mutex = NULL; @@ -406,7 +406,7 @@ mender_configure_download_artifact_callback( goto END; } cJSON_AddStringToObject(json_device_config, "artifact_name", artifact_name); - cJSON_AddItemToObject(json_device_config, "config", meta_data); + cJSON_AddItemToObject(json_device_config, "config", cJSON_Duplicate(meta_data, true)); if (NULL == (device_config = cJSON_PrintUnformatted(json_device_config))) { mender_log_error("Unable to allocate memory"); ret = MENDER_FAIL;