[Common/Collect] check null param
authorJaeyun <jy1210.jung@samsung.com>
Mon, 12 Apr 2021 03:24:40 +0000 (12:24 +0900)
committerjaeyun-jung <39614140+jaeyun-jung@users.noreply.github.com>
Tue, 13 Apr 2021 13:13:42 +0000 (22:13 +0900)
add condition to check null param (public functions only)

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
gst/nnstreamer/tensor_common_pipeline.c

index a1b81e2..806ebb4 100644 (file)
@@ -57,6 +57,8 @@ gst_tensor_time_sync_get_mode_string (tensor_time_sync_mode mode)
 gboolean
 gst_tensor_time_sync_set_option_data (tensor_time_sync_data * sync)
 {
+  g_return_val_if_fail (sync != NULL, FALSE);
+
   if (sync->mode == SYNC_END || sync->option == NULL)
     return FALSE;
 
@@ -137,6 +139,10 @@ gst_tensor_time_sync_get_current_time (GstCollectPads * collect,
   GSList *walk = NULL;
   guint count, empty_pad;
 
+  g_return_val_if_fail (collect != NULL, FALSE);
+  g_return_val_if_fail (sync != NULL, FALSE);
+  g_return_val_if_fail (current_time != NULL, FALSE);
+
   walk = collect->data;
   count = empty_pad = 0;
 
@@ -186,6 +192,8 @@ gst_tensor_time_sync_flush (GstCollectPads * collect)
   GSList *walk;
   GstTensorCollectPadData *pad;
 
+  g_return_if_fail (collect != NULL);
+
   walk = collect->data;
   while (walk) {
     pad = (GstTensorCollectPadData *) walk->data;
@@ -263,6 +271,12 @@ gst_tensor_time_sync_buffer_from_collectpad (GstCollectPads * collect,
   GstTensorsConfig in_configs;
   GstClockTime base_time = 0;
 
+  g_return_val_if_fail (collect != NULL, FALSE);
+  g_return_val_if_fail (sync != NULL, FALSE);
+  g_return_val_if_fail (tensors_buf != NULL, FALSE);
+  g_return_val_if_fail (configs != NULL, FALSE);
+  g_return_val_if_fail (is_eos != NULL, FALSE);
+
   walk = collect->data;
   counting = empty_pad = 0;