@@ -759,18 +759,24 @@ static int server_check_during_dwl(void)
*/
server_op_res_t result =
server_get_deployment_info(channel, &channel_data, &action_id);
- if (channel_data.json_reply != NULL &&
- json_object_put(channel_data.json_reply) != JSON_OBJECT_FREED) {
- ERROR("JSON object should be freed but was not.\n");
- }
if (result == SERVER_UPDATE_CANCELED) {
/* Mark that an update was cancelled by the server */
server_hawkbit.cancelDuringUpdate = true;
ret = -1;
}
update_action = json_get_deployment_update_action(channel_data.json_reply);
+
+ /* if the deployment is skipped then stop downloading */
+ if (update_action == deployment_update_action.skip)
+ ret = -1;
+
check_action_changed(action_id, update_action);
+ /* Cleanup and free resources */
+ if (channel_data.json_reply != NULL &&
+ json_object_put(channel_data.json_reply) != JSON_OBJECT_FREED) {
+ ERROR("JSON object should be freed but was not.\n");
+ }
channel->close(channel);
free(channel);
When the backend is polled during a download, the following error happens: Server delivered empty. 'update' skipping The cause is that the json resource is freed before evaluating the update action. Rearrange the function and frees the JSON object with json_object_put just before returning. Signed-off-by: Stefano Babic <sbabic@denx.de> --- suricatta/server_hawkbit.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)