fix coverity CID: 1123841, 1123966
authorYongjoo Ahn <yongjoo1.ahn@samsung.com>
Tue, 11 Feb 2020 06:39:32 +0000 (15:39 +0900)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Wed, 12 Feb 2020 01:42:50 +0000 (17:42 -0800)
1123841 - check the return value of sensor_listener_start
1123966 - g_free the newly allocated memory

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
ext/nnstreamer/tensor_source/tensor_src_tizensensor.c

index 3da560b..b6eb10e 100644 (file)
@@ -590,6 +590,7 @@ _ts_configure_handle (GstTensorSrcTIZENSENSOR * self)
           "The requested sensor sequence %d for sensor %d is not available. The max-sequence is used instead",
           self->sequence, self->type);
       self->sequence = 0;
+      g_free (list);
       return -EINVAL;
     }
 
@@ -867,8 +868,16 @@ gst_tensor_src_tizensensor_start (GstBaseSrc * src)
   gst_base_src_set_dynamic_size (src, FALSE);
 
   /* 3. Fire it up! */
+  if (sensor_listener_start (self->listener) != 0) {
+    /* Failed to start listener. Clean this up */
+    ret = _ts_clean_up_handle (self);
+    if (ret) {
+      GST_ERROR_OBJECT (self, "_ts_clean_up_handle () returns %d", ret);
+    }
+    retval = FALSE;
+    goto exit;
+  }
   self->running = TRUE;
-  sensor_listener_start (self->listener);
 
   /** complete the start of the base src */
   gst_base_src_start_complete (src, GST_FLOW_OK);