tizenwlsink: Add null check for 'wl_compositor_create_surface' 49/296949/2 accepted/tizen/unified/20230808.170207
authorjiyong.min <jiyong.min@samsung.com>
Tue, 8 Aug 2023 00:15:33 +0000 (09:15 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Tue, 8 Aug 2023 02:06:37 +0000 (11:06 +0900)
- Previously, it's null if memory allocation is failed.

[Version] 1.22.0-7
[Issue Type] Bug fix

Change-Id: I87a26077f055bc2de1ddabe44f4263982894bacb

packaging/gst-plugins-tizen.spec
tizenwlsink/src/wlwindow.c

index 9131958..210c7a9 100644 (file)
@@ -5,7 +5,7 @@
 Name:       gst-plugins-tizen
 Version:    1.22.0
 Summary:    GStreamer tizen plugins (common)
-Release:    6
+Release:    7
 Group:      Multimedia/Framework
 Url:        http://gstreamer.freedesktop.org/
 License:    LGPL-2.1+
index e00c678..0e80488 100644 (file)
@@ -210,10 +210,21 @@ gst_wl_window_new_internal (GstWlDisplay * display)
   window->render_lock = render_lock;
 
   window->area_surface = wl_compositor_create_surface (display->compositor);
+  if (!window->area_surface) {
+    GST_ERROR ("wl_compositor_create_surface(wl_compositor@%p) failed", display->compositor);
+    g_object_unref(window);
+    return NULL;
+  }
   GST_WARNING
       ("area_surface(wl_surface)@%p = wl_compositor_create_surface(wl_compositor@%p)",
       window->area_surface, display->compositor);
   window->video_surface = wl_compositor_create_surface (display->compositor);
+  if (!window->video_surface) {
+    GST_ERROR ("wl_compositor_create_surface(wl_compositor@%p) failed", display->compositor);
+    wl_surface_destroy(window->area_surface);
+    g_object_unref(window);
+    return NULL;
+  }
   GST_WARNING
       ("video_surface(wl_surface)@%p = wl_compositor_create_surface(wl_compositor@%p)",
       window->video_surface, display->compositor);
@@ -412,6 +423,10 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info,
 /* not create shell_surface here for enlightenment */
   display->need_shell_surface = TRUE;
   window = gst_wl_window_new_internal (display, NULL, render_lock);
+  if (!window) {
+    GST_ERROR ("gst_wl_window_new_internal(GstWlDisplay@%p) failed", display);
+    return NULL;
+  }
 
   /* for tizen enlightenment */
 #if 0
@@ -449,6 +464,10 @@ gst_wl_window_new_toplevel (GstWlDisplay * display, const GstVideoInfo * info,
   gint width;
 
   window = gst_wl_window_new_internal (display);
+  if (!window) {
+    GST_ERROR ("gst_wl_window_new_internal(GstWlDisplay@%p) failed", display);
+    return NULL;
+  }
 
   /* go toplevel */
   window->shell_surface = wl_shell_get_shell_surface (display->shell,
@@ -588,6 +607,11 @@ gst_wl_window_new_in_surface (GstWlDisplay * display,
     window = gst_wl_window_new_internal (display, NULL, render_lock);
   }
 
+  if (!window) {
+    GST_ERROR ("gst_wl_window_new_internal(GstWlDisplay@%p) failed", display);
+    return NULL;
+  }
+
   /*Area surface from App need to be under parent surface */
   if (display->tizen_policy) {
     GST_INFO