From f95d9600ea982772e1d5197a525bc9d1351bb084 Mon Sep 17 00:00:00 2001 From: Yongjoo Ahn Date: Mon, 19 Sep 2022 17:24:20 +0900 Subject: [PATCH] [coverity] Check return value in query_client cb - Check return values in sink callback Signed-off-by: Yongjoo Ahn --- c/src/ml-api-service-query-client.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/c/src/ml-api-service-query-client.c b/c/src/ml-api-service-query-client.c index 2c6fc3a..6bdb547 100644 --- a/c/src/ml-api-service-query-client.c +++ b/c/src/ml-api-service-query-client.c @@ -32,11 +32,23 @@ _sink_callback_for_query_client (const ml_tensors_data_h data, ml_tensors_data_s *_copied_data_s; guint i, count = 0U; + int status; - ml_tensors_data_create (info, &copied_data); + status = ml_tensors_data_create (info, &copied_data); + if (ML_ERROR_NONE != status) { + _ml_error_report_continue + ("Failed to create a new tensors data for query_client."); + return; + } _copied_data_s = (ml_tensors_data_s *) copied_data; - ml_tensors_info_get_count (info, &count); + status = ml_tensors_info_get_count (info, &count); + if (ML_ERROR_NONE != status) { + _ml_error_report_continue + ("Failed to get count of tensors info from tensor_sink."); + return; + } + for (i = 0; i < count; ++i) { memcpy (_copied_data_s->tensors[i].tensor, data_s->tensors[i].tensor, data_s->tensors[i].size); -- 2.7.4