From 447b15a623a833e1ead7341dc40b95f140a2669d Mon Sep 17 00:00:00 2001 From: "srinivasa.m" Date: Mon, 26 Aug 2019 20:11:35 +0530 Subject: [PATCH] Coverity Issues Fix Change-Id: I11052fd2b6cf3bb55c031a7928f07ab307476c52 --- common/fido_json_handler.c | 6 ++++++ server/fido_server.c | 3 +++ server/fido_uaf_policy_checker.c | 3 +++ 3 files changed, 12 insertions(+) diff --git a/common/fido_json_handler.c b/common/fido_json_handler.c index af212f7..3b8e4b2 100755 --- a/common/fido_json_handler.c +++ b/common/fido_json_handler.c @@ -1110,6 +1110,9 @@ _uaf_parser_parse_asm_response_discover(GList *asm_response_list, int *error_cod int auth_index = json_object_get_int_member(auth_obj, _JSON_KEY_AUTH_INDEX); char *auth_idx_str = (char*)calloc(1, 128); + if(auth_idx_str == NULL) { + SAFE_DELETE(auth_info); + } CATCH_IF_FAIL(auth_idx_str != NULL); snprintf(auth_idx_str, 127, "%d", auth_index); @@ -3184,6 +3187,9 @@ _uaf_parser_parser_asm_get_reg_response(const char *get_reg_resp) if (app_id != NULL || key_id_list != NULL) { _asm_app_reg_t *app_reg = (_asm_app_reg_t*) calloc(1, sizeof(_asm_app_reg_t)); + if(app_reg == NULL) { + g_list_free_full(key_id_list, free); + } CATCH_IF_FAIL(app_reg != NULL); if (app_id != NULL) { _INFO("app_id = [%s]", app_id); diff --git a/server/fido_server.c b/server/fido_server.c index 25f5c7d..d872905 100755 --- a/server/fido_server.c +++ b/server/fido_server.c @@ -1182,6 +1182,9 @@ _discover_response_cb_for_process(int tz_error_code, int error_code, GList *avai if (match_data != NULL) { _ui_auth_data_t *ui_data = (_ui_auth_data_t*) calloc(1, sizeof(_ui_auth_data_t)); + if(ui_data == NULL) { + g_list_free_full(ui_data_list, _free_matched_auth_data); + } RET_IF_FAIL_VOID(ui_data != NULL); if (match_data->asm_id != NULL) ui_data->asm_id = strdup(match_data->asm_id); diff --git a/server/fido_uaf_policy_checker.c b/server/fido_uaf_policy_checker.c index 23fc84f..695f3ec 100755 --- a/server/fido_uaf_policy_checker.c +++ b/server/fido_uaf_policy_checker.c @@ -376,6 +376,9 @@ __copy_png_list(GList *src_list) fido_rgb_pallette_entry_s *plte_src_data = (fido_rgb_pallette_entry_s*)(p_iter->data); if (plte_src_data != NULL) { fido_rgb_pallette_entry_s *plte_dest_data = calloc(1, sizeof(fido_rgb_pallette_entry_s)); + if(plte_dest_data == NULL) { + free(dest_data); + } RET_IF_FAIL(plte_dest_data != NULL, NULL); plte_dest_data->r = plte_src_data->r; plte_dest_data->g = plte_src_data->g; -- 2.7.4