From 4372ba8999dfbf5a7ae3711c0f457a976a4057c4 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Wed, 23 Apr 2014 12:42:32 -0400 Subject: [PATCH] glmemory: User g_slice_new0 to ensure fully initilized structure The pbo pointer not being initialized would trigger a use of unitilialized variable in valgrind. --- gst-libs/gst/gl/gstglmemory.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index ed36aaaeb5..a63e4034b0 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -527,7 +527,7 @@ _gl_mem_new (GstAllocator * allocator, GstMemory * parent, GST_CAT_TRACE (GST_CAT_GL_MEMORY, "created texture %u", data.result); - mem = g_slice_alloc (sizeof (GstGLMemory)); + mem = g_slice_new0 (GstGLMemory); _gl_mem_init (mem, allocator, parent, context, tex_type, width, height, stride, user_data, notify); @@ -758,7 +758,7 @@ _gl_mem_copy (GstGLMemory * src, gssize offset, gssize size) gst_gl_context_thread_add (src->context, _gl_mem_copy_thread, ©_params); - dest = g_slice_alloc (sizeof (GstGLMemory)); + dest = g_slice_new0 (GstGLMemory); _gl_mem_init (dest, src->mem.allocator, NULL, src->context, src->tex_type, src->width, src->height, src->stride, NULL, NULL); @@ -887,7 +887,7 @@ gst_gl_memory_wrapped_texture (GstGLContext * context, guint texture_id, GstGLMemory *mem; guint n_gl_bytes = _gl_texture_type_n_bytes (tex_type); - mem = g_slice_alloc (sizeof (GstGLMemory)); + mem = g_slice_new0 (GstGLMemory); _gl_mem_init (mem, _gl_allocator, NULL, context, tex_type, width, height, width * n_gl_bytes, NULL, NULL);