subsys/mgmt/hawkbit: Cleanup connection if error after http_request

All errors that occured after http_request should clean up the
connection.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit is contained in:
Yong Cong Sin 2021-08-31 16:37:15 +08:00 committed by Christopher Friedt
commit 5cee596c9b

View file

@ -718,7 +718,6 @@ static void response_cb(struct http_response *rsp,
LOG_ERR("Failed to realloc memory");
hb_context.code_status =
HAWKBIT_METADATA_ERROR;
cleanup_connection();
break;
}
@ -793,7 +792,6 @@ static void response_cb(struct http_response *rsp,
LOG_ERR("Failed to realloc memory");
hb_context.code_status =
HAWKBIT_METADATA_ERROR;
cleanup_connection();
break;
}
@ -1133,7 +1131,7 @@ enum hawkbit_response hawkbit_probe(void)
}
if (hb_context.code_status == HAWKBIT_METADATA_ERROR) {
goto error;
goto cleanup;
}
if (hawkbit_results.base.config.polling.sleep) {
@ -1216,7 +1214,7 @@ enum hawkbit_response hawkbit_probe(void)
}
if (hb_context.code_status == HAWKBIT_METADATA_ERROR) {
goto error;
goto cleanup;
}
hawkbit_dump_deployment(&hawkbit_results.dep);