plugins: fix gstgl and vaapi memory leaks

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 <victorx.jaquez@intel.com>

https://bugzilla.gnome.org/show_bug.cgi?id=763354
This commit is contained in:
Vineeth TM 2016-03-09 11:03:28 +09:00 committed by Víctor Manuel Jáquez Leal
parent 805a4733bf
commit 1608eff3e5

View file

@ -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;