From adf47ea7284ad2097e9907baf7a86fca90623434 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 11 Jul 2016 21:29:10 +1000 Subject: [PATCH] glbasememory: assert for a valid allocator instead of segfaulting --- gst-libs/gst/gl/gstglbasememory.c | 2 ++ gst-libs/gst/gl/gstglbasememory.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/gl/gstglbasememory.c b/gst-libs/gst/gl/gstglbasememory.c index 915e19e3b5..2d4c8c3147 100644 --- a/gst-libs/gst/gl/gstglbasememory.c +++ b/gst-libs/gst/gl/gstglbasememory.c @@ -732,6 +732,8 @@ gst_gl_base_memory_alloc (GstGLBaseMemoryAllocator * allocator, { GstGLBaseMemoryAllocatorClass *alloc_class; + g_return_val_if_fail (GST_IS_GL_BASE_MEMORY_ALLOCATOR (allocator), NULL); + alloc_class = GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS (allocator); g_return_val_if_fail (alloc_class != NULL, NULL); diff --git a/gst-libs/gst/gl/gstglbasememory.h b/gst-libs/gst/gl/gstglbasememory.h index 642684a542..bee28444ee 100644 --- a/gst-libs/gst/gl/gstglbasememory.h +++ b/gst-libs/gst/gl/gstglbasememory.h @@ -32,7 +32,7 @@ G_BEGIN_DECLS #define GST_TYPE_GL_BASE_MEMORY_ALLOCATOR (gst_gl_base_memory_allocator_get_type()) GType gst_gl_base_memory_allocator_get_type(void); -#define GST_IS_GL_BASE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_ALLOCATOR)) +#define GST_IS_GL_BASE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR)) #define GST_IS_GL_BASE_MEMORY_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR)) #define GST_GL_BASE_MEMORY_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR, GstGLBaseMemoryAllocatorClass)) #define GST_GL_BASE_MEMORY_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_BASE_MEMORY_ALLOCATOR, GstGLBaseMemoryAllocator))