[coverity] Check return value in query_client cb
authorYongjoo Ahn <yongjoo1.ahn@samsung.com>
Mon, 19 Sep 2022 08:24:20 +0000 (17:24 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Tue, 20 Sep 2022 01:55:35 +0000 (10:55 +0900)
- Check return values in sink callback

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
c/src/ml-api-service-query-client.c

index 2c6fc3a..6bdb547 100644 (file)
@@ -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);