From 1608eff3e58e27a607bc9e2b7154386eeabb1bc5 Mon Sep 17 00:00:00 2001 From: Vineeth TM Date: Wed, 9 Mar 2016 11:03:28 +0900 Subject: [PATCH] plugins: fix gstgl and vaapi memory leaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1\ Unref gl_display and gl_window as soon they are not needed. 2\ Remove an unneeded display type check, since is handled by gst_vaapi_created_display_from_handle() 3\ Unref vaapi's display if the display cannot be bind to a GL API. Modified-by: Víctor Manuel Jáquez Leal https://bugzilla.gnome.org/show_bug.cgi?id=763354 --- gst/vaapi/gstvaapipluginutil.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c index 13c48afb53..a8d6a30271 100644 --- a/gst/vaapi/gstvaapipluginutil.c +++ b/gst/vaapi/gstvaapipluginutil.c @@ -174,14 +174,14 @@ gst_vaapi_create_display_from_gl_context (GstObject * gl_context_object) display_type = GST_VAAPI_DISPLAY_TYPE_WAYLAND; #endif } + gst_object_unref (gl_window); break; } default: display_type = GST_VAAPI_DISPLAY_TYPE_ANY; break; } - if (!display_type) - return NULL; + gst_object_unref (gl_display); display = gst_vaapi_create_display_from_handle (display_type, native_display); if (!display) @@ -209,8 +209,10 @@ gst_vaapi_create_display_from_gl_context (GstObject * gl_context_object) out_display = NULL; break; } - if (!out_display) + if (!out_display) { + gst_vaapi_display_unref (display); return NULL; + } gst_vaapi_display_egl_set_gl_context (GST_VAAPI_DISPLAY_EGL (out_display), GSIZE_TO_POINTER (gst_gl_context_get_gl_context (gl_context))); break;