webrtc_sink/source: Fix resource leaks 54/280454/2
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 30 Aug 2022 08:22:38 +0000 (17:22 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 31 Aug 2022 03:26:29 +0000 (12:26 +0900)
[Version] 0.3.221
[Issue Type] Coverity defect

Change-Id: I318bcb7d6e962df59c36988d02d89d785dc23a7b
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
src/webrtc_sink.c
src/webrtc_source.c

index 5a64d5ce0dd95a59597612f1f0dd3f42a0e97fad..ef5b4e989071bfdd439e40acb03fe7cbc0476ea8 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.220
+Version:    0.3.221
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index bdad118efe429bef16578e0015e4228d787acb72..a34e533554ca6bd4350cc88df040aa978527a260 100644 (file)
@@ -175,10 +175,14 @@ static int __build_videosink(webrtc_s *webrtc, GstElement *decodebin, GstPad *sr
 
                        /* FIXME: The order of setting property and display is important when 'use-tbm' is true. The reverse does not work */
                        gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(videosink), sink->display->overlay_surface_id);
-                       RET_VAL_IF(!g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(videosink)), "display-geometry-method"),
-                               WEBRTC_ERROR_INVALID_OPERATION, "could not find 'display-geometry-method' property");
-                       RET_VAL_IF(!g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(videosink)), "visible"),
-                               WEBRTC_ERROR_INVALID_OPERATION, "could not find 'visible' property");
+                       if (!g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(videosink)), "display-geometry-method")) {
+                               LOG_ERROR("could not find 'display-geometry-method' property");
+                               goto exit;
+                       }
+                       if (!g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(videosink)), "visible")) {
+                               LOG_ERROR("could not find 'visible' property");
+                               goto exit;
+                       }
 
                } else if (sink->display->type == WEBRTC_DISPLAY_TYPE_EVAS) {
                        GstCaps *caps;
index 429aab1177390b374b4447c2f88f8a2fdef7c997..ad9b4ba0e48c94e9f970dcc99c4ddd854c6594b4 100644 (file)
@@ -2280,10 +2280,14 @@ static int __build_loopback_videosink(webrtc_gst_slot_s *source, GstElement *lin
        if (source->display->type == WEBRTC_DISPLAY_TYPE_OVERLAY ||
                source->display->type == WEBRTC_DISPLAY_TYPE_ECORE_WL) {
                gst_video_overlay_set_wl_window_wl_surface_id(GST_VIDEO_OVERLAY(videosink), source->display->overlay_surface_id);
-               RET_VAL_IF(!g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(videosink)), "display-geometry-method"),
-                       WEBRTC_ERROR_INVALID_OPERATION, "could not find 'display-geometry-method' property");
-               RET_VAL_IF(!g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(videosink)), "visible"),
-                       WEBRTC_ERROR_INVALID_OPERATION, "could not find 'visible' property");
+               if (!g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(videosink)), "display-geometry-method")) {
+                       LOG_ERROR("could not find 'display-geometry-method' property");
+                       goto exit;
+               }
+               if (!g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(videosink)), "visible")) {
+                       LOG_ERROR("could not find 'visible' property");
+                       goto exit;
+               }
                g_object_set(G_OBJECT(videosink),
                        "display-geometry-method", (gint)source->display->mode, /* 0: letter box, 1: origin size, 2: full screen */
                        "visible", (gboolean)source->display->visible,